michael.zhang Posted August 16, 2011 Posted August 16, 2011 Hello, I was wondering if you could share with me detailed explanation (or code) that implements the PlayerActor's collision logic and gravity logic when the Physical flag is disabled. I assume that when the physical flag is disabled, you no longer use the BodyRigid to implement movement, so you must be doing manual updates to the node's transform? If so, when you detect a collision, how are you resolving the collision smoothly? Any detail on what the PlayerActor class is currently doing would be great. Michael Zhang
manguste Posted August 23, 2011 Posted August 23, 2011 When a player is not simulated as a rigid body, a simple dummy body with a capsule shape is used to calculate collisions. First of all, all contacts with a shape are found. After that, the player is pushed out of objects it collided with along the contact normal (the global penetration factor is also taken into account here). Effectively, it's a sum of all normal vectors of found contacts. Having calculated the new player position, we need to calculate velocity change as well. The initial velocity vector is projected onto each contact normal (the dot product is calculated) and the result is subtracted from the initial velocity.
michael.zhang Posted August 23, 2011 Author Posted August 23, 2011 Hello Manguste, Thank you for the information. Very useful.
Recommended Posts