I have a scene with a spatial that is a Sphere mesh, i initialize it’s physics that way in an AppState :
@Override
public void initialize(AppStateManager stateManager, Application app) {
super.initialize(stateManager, app);
bulletAppState = new BulletAppState();
bulletAppState.setDebugEnabled(true);
stateManager.attach(bulletAppState);
rootNode.attachChild(localRootNode);
Spatial scene = assetManager.loadModel("Scenes/level2.j3o");
localRootNode.attachChild(scene);
Spatial floor = localRootNode.getChild("floor");
bulletAppState.getPhysicsSpace().add(floor.getControl(RigidBodyControl.class));
Spatial Sphere = localRootNode.getChild("Sphere");
//bulletAppState.getPhysicsSpace().add(Sphere.getControl(RigidBodyControl.class));
bulletAppState.getPhysicsSpace().add(Sphere);
When the main is running the sphere rigidBody is falling, but the mesh does not move and follow.
What is missing ?
I guess the rigidbody control is attached to a child and thus moving that. Attach it to the geometry itself or it’s parent.
I can’t say for sure because I can’t see your hierarchy, but if it is moving a child it won’t move the parent so I can only assume the rigidbody control is too far up the hierarchy.
Sphere.getControl(RigidBodyControl.class).setKinematic(true);
?
i dont see sphere physics so i dont really know how you do it.
you need add proper physics control for sphere
if you want create simple ball physics, then everything is in JME tests and tutorials, just copy paste
This is the hierarchy
I added physics to Sphere with button “add collision shape”
I want sphere RigidBodyControl falling on ground.
pspeed
February 1, 2019, 5:29pm
5
How can you tell?
P.S.: imgur.com is a better image hosting site for posting to the forum. a) with a direct URL we can see the whole image without clicking through, b) if we click through we are way less likely to have viruses downloaded to our computer than from the ad-trash on postimg.cc
pspeed:
How can you tell?
I see it falling, it has a mass greater than 0.
pspeed
February 1, 2019, 5:35pm
7
You see “what” falling? Does the mesh move or not?
2 Likes
could you please create some TestCase code or make a video what happens there exactly?
Browser
February 2, 2019, 11:24am
9
I will share the scene and source code.
sgold
February 8, 2019, 4:21pm
10
Did you solve the problem?