Open youarereadingthis opened 5 months ago
Speed and normal now get flipped for the other collider, see if that gives you what you want
I no longer have to make an exception for spheres in my bounce code. However there is another bug that I neglected to mention until now, because I'm cool like that.
Hit surface normals(Collision.Contact.Normal
) are flipped for spheres when colliding against box colliders, mesh colliders, now sphere colliders(fixing one thing made it just as broken as the other things).
This is easily fixed by flipping them like the following code.
var surfNormal = c.Contact.Normal;
// Contact surface normals are fucked.
// if ( c.Other.Collider is not SphereCollider )
surfNormal *= -1;
Also, Contact.Speed
seems to return really inconsistent values that are not appropriate for bouncing spheres. Contact.Speed
will return wildly different values(like being reversed) depending on the size of the sphere, so I recommend different scales when debugging.
I fixed this by grabbing the last known velocity at the end of OnFixedUpdate
instead and it works exactly as it should. I figure workarounds are worse than not needing them, though.
Describe the bug
OnStartCollision is returning the wrong
Contact.Speed
when two spheres are involved. The direction is reversed.To Reproduce
Component.ICollisionListener
interface.collision.Contact.Speed
at contact point.Expected behavior
Spheres against spheres should return the velocity you were going, instead of the reverse.
Media/Files
Additional context
No response