Hi everyone, i making a car game and when i was adjusting a problem in wheels they stop its rotation. My code before the modification was like that:
//wheel is a DynamicNode...
whell.generatePhysicsGeometry();
whell.attachChild(load3DModel()); //no problem here
//some other settings
The 'generatePhysicsGeometry()' line was before 3D model attach line. If i put the 'generatePhysicsGeometry()' after the attach it solves my problem but it doesn't rotate anymore. Above some images of my wheels:
Before:
After:
It's clear that there are differences, but i don't understand what's wrong. Does anyone know?
In general, when you want to see what's going on physically press [v] to see the physics collision geometries not to see the boundings (they do not necessarily match).
generatePhysicsGeometry generates collision geometries for all children of the node. So this means it generates collision geometries for the newly attached model, too. As this seems to have bounding boxes you get boxes as physical wheel representation. Rotation will still work, but as you can imagine not very well
Instead of generating the collision geometries you can specify them explicitly, e.g. by calling createCapsule() and adjusting it's scale to an appropriate size. Then have a look at the physics debugger (hit [v]).