Skip to main content
gamedev.net
🔒 Locked

Sliding

Started by josericardo_jr 0 replies 800+ views
Original Post
josericardo_jr
josericardo_jr
Hi People, I was using this to calculate my sliding collision with wall: Vt += NI * (-dot(Ni,Vt) - Nd) Where: Vt = desired Position Ni = Normal of the plane of collision Nd = D of the plane equation. To calcule Nd, I used dot(Ni,Ps) where Ps is my contact point on the plane of collision. Is it right? Using this way, it doesn't work for me. It give me the right position where my character should go but always it stay inverse in vector component of my Normal Plane. For example, If my normal plane is ( 0, 0, 1 ), my target position is inverse in z, so, if my position should be ( 5, 5, 6 ), using this formula I found ( 5, 5, -6 ). Does anyone knows how I can adjust this? Thanks a lot. Ricardo
oliii
oliii
you dont need to use Nd.

Vt += -(Vt . N) * N

BTW, Vt is not the position. Vt is the velocity (or should be, or don't call it V).

If you have a position Pt,

Pt += ((Pt . N) +/- d) * N. This will put Pt on the plane.

+/- depending on what your d represents. try both, see what works better.
Everything is better with Metal.

Topic Locked

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

Sign in to reply to this topic.