Problem with Physics of a Bowling Pin

Hi guys!



So I'm building a simple bowling game and I'm having some issues with the physics of the bowling pin.



Here's the issue: If I run the code below, I get a bowling pin whose physics behave exactly like a punching ball, and when inserting many pins, some (when the game starts and the pins are inserted onto the scene) just go up wildly. In addition, the center of mass does not seem to be right, as it is located near the beginning of the bowling lane while the pin is near the end.


DynamicPhysicsNode dynamicNode = getPhysicsSpace().createDynamicNode();
setNode(dynamicNode);

Node pinNode = null;
pinNode = (Node) ModelLoader.load3ds("models/pin.3DS");
spatialPinNode = pinNode;
getRootNode().attachChild(dynamicNode);


dynamicNode.getLocalTranslation().set(startingPoint);
dynamicNode.getLocalScale().set(0.1f, 0.1f, 0.1f);
dynamicNode.getLocalRotation().fromAngleAxis(-(float) Math.PI / 2,
Vector3f.UNIT_X);

dynamicNode.attachChild(pinNode);
dynamicNode.generatePhysicsGeometry();
dynamicNode.computeMass();

SceneMonitor.getMonitor().registerNode(dynamicNode, name);

If I change the code in red for the code below (which does not seem the right thing to do, from my understanding of how the engine works and the purpose of each kind of class) everything seems to work right, except for the calls to spatialNode.getLocalTranslation() which, no matter what happens, always returns the same values:

pinNode.getLocalTranslation().set(startingPoint);
pinNode.getLocalScale().set(0.1f, 0.1f, 0.1f);
pinNode.getLocalRotation().fromAngleAxis(-(float) Math.PI / 2,
Vector3f.UNIT_X);

Any ideas? Help would be greatly appreciated!

Thanks,
Martin

try antoher localtranslatiopn for the pinnode to fix the center of mass

Thanks for the answer!



You mean doing a getLocalTranslation.set() for the pinNode besides for the dynamicNode?



I just tried it with different parameters, but still, same problem. Any other ideas? Did you had other thing in mind?