|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2009-2018 jMonkeyEngine
|
|
|
|
|
|
+ * Copyright (c) 2009-2019 jMonkeyEngine
|
|
* All rights reserved.
|
|
* All rights reserved.
|
|
*
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -59,10 +59,12 @@ import com.jme3.texture.Texture;
|
|
public class PhysicsTestHelper {
|
|
public class PhysicsTestHelper {
|
|
|
|
|
|
/**
|
|
/**
|
|
- * creates a simple physics test world with a floor, an obstacle and some test boxes
|
|
|
|
- * @param rootNode
|
|
|
|
- * @param assetManager
|
|
|
|
- * @param space
|
|
|
|
|
|
+ * creates a simple physics test world with a floor, an obstacle and some
|
|
|
|
+ * test boxes
|
|
|
|
+ *
|
|
|
|
+ * @param rootNode where lights and geometries should be added
|
|
|
|
+ * @param assetManager for loading assets
|
|
|
|
+ * @param space where collision objects should be added
|
|
*/
|
|
*/
|
|
public static void createPhysicsTestWorld(Node rootNode, AssetManager assetManager, PhysicsSpace space) {
|
|
public static void createPhysicsTestWorld(Node rootNode, AssetManager assetManager, PhysicsSpace space) {
|
|
AmbientLight light = new AmbientLight();
|
|
AmbientLight light = new AmbientLight();
|
|
@@ -161,8 +163,9 @@ public class PhysicsTestHelper {
|
|
|
|
|
|
/**
|
|
/**
|
|
* creates a box geometry with a RigidBodyControl
|
|
* creates a box geometry with a RigidBodyControl
|
|
- * @param assetManager
|
|
|
|
- * @return
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param assetManager for loading assets
|
|
|
|
+ * @return a new Geometry
|
|
*/
|
|
*/
|
|
public static Geometry createPhysicsTestBox(AssetManager assetManager) {
|
|
public static Geometry createPhysicsTestBox(AssetManager assetManager) {
|
|
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
@@ -177,8 +180,9 @@ public class PhysicsTestHelper {
|
|
|
|
|
|
/**
|
|
/**
|
|
* creates a sphere geometry with a RigidBodyControl
|
|
* creates a sphere geometry with a RigidBodyControl
|
|
- * @param assetManager
|
|
|
|
- * @return
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param assetManager for loading assets
|
|
|
|
+ * @return a new Geometry
|
|
*/
|
|
*/
|
|
public static Geometry createPhysicsTestSphere(AssetManager assetManager) {
|
|
public static Geometry createPhysicsTestSphere(AssetManager assetManager) {
|
|
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
|
@@ -193,10 +197,11 @@ public class PhysicsTestHelper {
|
|
|
|
|
|
/**
|
|
/**
|
|
* creates an empty node with a RigidBodyControl
|
|
* creates an empty node with a RigidBodyControl
|
|
- * @param manager
|
|
|
|
- * @param shape
|
|
|
|
- * @param mass
|
|
|
|
- * @return
|
|
|
|
|
|
+ *
|
|
|
|
+ * @param manager for loading assets
|
|
|
|
+ * @param shape a shape for the collision object
|
|
|
|
+ * @param mass a mass for rigid body
|
|
|
|
+ * @return a new Node
|
|
*/
|
|
*/
|
|
public static Node createPhysicsTestNode(AssetManager manager, CollisionShape shape, float mass) {
|
|
public static Node createPhysicsTestNode(AssetManager manager, CollisionShape shape, float mass) {
|
|
Node node = new Node("PhysicsNode");
|
|
Node node = new Node("PhysicsNode");
|
|
@@ -206,10 +211,12 @@ public class PhysicsTestHelper {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * creates the necessary inputlistener and action to shoot balls from the camera
|
|
|
|
- * @param app
|
|
|
|
- * @param rootNode
|
|
|
|
- * @param space
|
|
|
|
|
|
+ * creates the necessary inputlistener and action to shoot balls from the
|
|
|
|
+ * camera
|
|
|
|
+ *
|
|
|
|
+ * @param app the application that's running
|
|
|
|
+ * @param rootNode where ball geometries should be added
|
|
|
|
+ * @param space where collision objects should be added
|
|
*/
|
|
*/
|
|
public static void createBallShooter(final Application app, final Node rootNode, final PhysicsSpace space) {
|
|
public static void createBallShooter(final Application app, final Node rootNode, final PhysicsSpace space) {
|
|
ActionListener actionListener = new ActionListener() {
|
|
ActionListener actionListener = new ActionListener() {
|