It means you’re trying to fit a square peg in a round hole.
line 6. The loader seems to return a Geometry and you try to cast it to Node. Just remove the cast, you don’t need it, you’re only using methods that are member of Spatial.
@nehon Thanks for your response
but I was trying to cast it to a node because collision is not applied on the model Don’t know why.
do you have any idea why it is not working? Is the type .Obj is the cause of the problem ?
@Maha said:
@nehon Thanks for your response :)
but I was trying to cast it to a node because collision is not applied on the model :( Don't know why.
do you have any idea why it is not working? Is the type .Obj is the cause of the problem ? :)
What you cast something to will make no difference in how it functions. If you can call the method on Spatial then the same code gets called if you cast it to Geometry or Node first. Basic OOP.
shipNode = new Node("shipNode");
shipNode.attachChild(Ship);
mainScene.attachChild(shipNode);
CollisionShape sceneShape =
CollisionShapeFactory.createMeshShape((Node) Ship);
mainScene.attachChild(Ship);
Ship_phy = new RigidBodyControl(sceneShape,0f);
Ship.addControl(Ship_phy);
Ship_phy.setGravity(new Vector3f(0f, 0f, 0f)); // no gravity effects
Ship_phy.setLinearVelocity(new Vector3f(100f, 100f, 100f));
bulletAppState.getPhysicsSpace().add(Ship);
[/java]
what’s wrong here?
i declared bullet application state, rigitBodyControl and applied it on the ship (model) and applied the bulletappState. where is the error
P.S.: You will make experienced Java developers less queasy if you stop capitalizing your variables like class names. This makes my brain hurt:
Ship = assetManager.loadModel(“Models/tall-ship-sailboat-clipper-f/ship_boat.j3o”);