Skip to main content
GameDev.net gamedev.net
🔒 Locked

problem with collision response

Started by phaelax Dec 28, 2004 at 6:52 PM 0 replies 400+ views
Original Post
phaelax
phaelax
I can get the intersection point, no problems there. It's the sliding response that doesn't work properly for me. Here's what I've got.

//newPos is the ellipsoid's position when the collision occurs
//normal of sliding plane
Vector slidingNormal = newPos - intersection;
Vector slidingNormalNormalized = slidingNormal.normalized();

//signed distance between original destination point and sliding plane
double distance = -(slidingNormalNormalized * intersection);
distance = vEnd.dot(slidingNormalNormalized) + distance;
//project remaining velocity vector onto sliding plane
Vector finalPos = vEnd - (slidingNormalNormalized*distance);
//get new position of ellipsoid
finalPos = finalPos + slidingNormal;

//translate back from ellipsoid space and return
It basically works on planes that are aligned to the axis', but non-aligned planes I seem to walk through. Like I said, finding the intersection point works fine. Any suggestions?
Zakwayda
Zakwayda
I see what you're doing, but unfortunately I'm too tired to have any hope of finding the errors (if there are any) in your code :(

It may be that you're already using the paper 'Improved Collision Detection and Response' as a reference for this code, but if not, I'd recommend digging up that paper, as it has working code for exactly what you're trying to do.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.