Hello! I have been trying the bulletAppState for a moment now, but am hitting a wall:
When I direcly add the sceneNode whit the addControl and add to physical space, I get the shapes I want, but when I do a collision, then I only colide whit the node, losing all the information I put in the userData of some spatials I added to the scene.
Also, when I try to directly add the items that contains those userdata information as RigidBodyControl, it just won’t correctly scale the CollisionShape for some reason, so i only get tiny boxes that i can never touch
Any tips available? This is slowly getting me insane
Well, because the spatial was already that size. Why would the RigidBodyControl base itself on any information at all then?
I mean the spatial was initialized as this size on my scene because I set it that way in the editor. It seems counter initiative to then have to simply scale the collision box the right way by getting into the whole mess like this
According to that logic it doesn’t make sense to add the RigidBody to a PhysicsSpace then. See, you have two separate things here: One is the scenegraph with rendered objects, one is the physics system with RigidBodies, collision shapes etc. They are completely separate - each works without the other. The only thing that happens is that the positional information from the physics object is transferred to the scenegraph object. The physics object could (and will in most cases) have a different shape than the scenegraph object. You’ll have hull shapes for complex geometries, boxes instead of simple small objects etc. etc.
So the RigidBodyControl DOES NOT base itself on any information from the scenegraph, it bases itself on the information you give to it. The CollisionShapeFactory is the only thing that uses scenegraph information to help you have an initial physics object.
Furthermore, in bullet the scale of an object is - as you found out - based on its collision shape, NOT on the RigidBody. As you can use one collision shape for multiple objects to save memory it would be a HUGE mess to have a physics control check the scale of its spatial each frame and apply that to the collision shape of the managed physics object. This could cause all kinds of objects in the physics space to suddenly change their size. And again - it would be the ONLY thing that a spatial suddenly transfers to the physics object. Unless a physics control is set to kinematic mode not even the position of the spatial affects the physics object location.