Collison fails when rotating PhysicsNode

I have a rectangular PhysicsNode like this. At this stage it works just as it should.

http://i.imgur.com/G844M.jpg (The wooden thing)



But when i rotate the PhysicsNode, the collision of it fails, kinda like this: http://i.imgur.com/2WUdD.jpg

I can stand on the green area but fall through the red. You can see my character falling through.



It is a BoxCollisionShape with the dimensions (6f, 0.3f, 1.3f). Same size as the Geometry.

I tried increasing the dimensions of the BoxCollisionShape and I think it helped a little, but you can then stand in air on some places.

I guess you rotate your PhysicsNodes with setLocalRotation() which is wrong as you would know if you had read the tutorials.

I do platform1.rotate(0f, tpf*.5f, 0f); every frame in the simpleUpdate method. I have checked the Hello tutorials but none of them are about PhysicsNode rotation.

Yeah, thats wrong. You have to apply forces to rotate the physics object, the HelloPhysics tutorial as well as the HelloCollision tutorial state this. Simply setting the location or rotation means “beaming” the object, also into walls etc.

And how do i do that on my otherwise static box with no mass? Making it spin around it’s center at a constant speed.

I was unable to find anything about rotating PhysicsNode in HelloPhysics nor HelloCollision.



Thanks for helping me out with all my noob questions :slight_smile: Sorry if I make a lot of threads for you.

No mass and moving is a physics environment does not work, without mass theres no physics. Your node has to have a mass and then you set it to kinematic mode. Then and only then you can directly set the location etc. and it will be translated to forces in the physics system. Also, look at the recent changes of the physics to controls instead of nodes, you should use setPhysicsLocation() and setPhysicsRotation() instead of moving the node itself.

2 Likes

I’ll look it up then. If you got some good examples/tutorials on kinematic mode feel free to post them.



Edit: huh, just doing platform1.setKinematic(true); seemed to fix my problem. I do not fall through it anymore :smiley:

1 Like
WASD said:
Edit: huh, just doing platform1.setKinematic(true); seemed to fix my problem. I do not fall through it anymore :D

This will not work in the current version anymore.

I will have to change it then when/if I update.