Why is it when i use the following code to spawn a box above the ground it continues to spawn into the ground at 0,0,0 here is my spawning code
[java]
//Create new block
Spatial tmp_block = assetManager.loadModel("Models/box.j3o");
tmp_block.move(0.0f, 20.0f, 0.0f);
rootNode.attachChild(tmp_block);
bulletAppState.getPhysicsSpace().add(tmp_block);
[/java]
Because you apparently added a physics rigidbody and collision shape to the geometry, you have to move the rigidbody.
Thanks norman, You reminded me i had to add a weight to it. My solution was to do this
RigidBodyControl tmp_block_physics = new RigidBodyControl(0.1f);
tmp_block.addControl(tmp_block_physics);
:? That makes no sense but w/e
Maybe everything isn’t apperent as they might seem with out asking a few questions first
Did you add a RigidBody to the box in the SceneComposer? Because if you did whats happening now is that you have two and only move the second, the first you created in the editor is never used.
At first yes I added a ridgid body in the scene composer, If memory serves i think it was crashing or just getting stuck so I deleted the “PhysicsControl” from the scenecomposer and added in code physics.
But you brought up a good point to my attention your saying that I have the ability to access the physics control from java code that was pre-placed from the editor. I originally thought added a physics control from the editor automatically applyed physics when attached to the rootnode.
Theres absolutely no difference between what you do in code or the scene editor.
Good to know, Thanks for your help normen.