![]() |
Help Debug Collisions position and normal - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: General (https://obi.virtualmethodstudio.com/forum/forum-5.html) +--- Thread: Help Debug Collisions position and normal (/thread-4188.html) |
Debug Collisions position and normal - spikebor - 28-04-2024 Hi there, I can use this code to collide with the Obi softbody and push my character up, I just have a problem with debugging the collision position and normal. In this picture, the yellow line is the debug line, it does not look like it's drawing correct contact position or normal. From my understanding, using solver.transform.TransformPoint and solver.transform.TransformDirection is the way to convert those local data to world space, but why it's incorrect? ![]() Code: [RequireComponent(typeof(ObiSolver))] RE: Debug Collisions position and normal - josemendez - 28-04-2024 Hi! contact.pointA is a barycentric point on the simplex, averaging it together with contact.pointB (which is a point on the surface of the collider, expressed in solver space) doesn’t make any sense. See: https://obi.virtualmethodstudio.com/manual/6.3/scriptingcollisions.html RE: Debug Collisions position and normal - spikebor - 29-04-2024 (28-04-2024, 06:53 PM)josemendez Wrote: Hi! Thank you, I got the position correct now. I'm using Vector3 contactNm = contact.normal.normalized; Is this correct? I think it should be inverted. ![]() RE: Debug Collisions position and normal - josemendez - 29-04-2024 Hi, Yes, it's correct. Normals are perpendicular to the surface the particles are colliding against -in this case, the character's collider- so they're pointing the right way. If you want to invert them, just negate them. Note there is no need to normalize normals, they have unit length by definition. kind regards, |