Jump to content
  • Advertisement
Sign in to follow this  
eskimo456

point to plane equation possible rearranging required?

This topic is 2871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi

I am using a bounding box as an initial quick test once this has collided, I am them attempting to use a point to plane test with a barycentric traingle to get precise collision with a wall.

I have a formula that seems to work on paper but when I use it in the computer it looks as though it is the wrong way around.

My formula is..
s = (p-a).N;
c.x = p.x-s*N.x
c.y = p.y,s*N.y
c.z = p.z,s*N.z


p is point of interest, a is point on plane, and n is normalised normal.

I get an answer of 0 initially but if I move my character into a wall I then get an answer of 50. The point to plane test gives a distance of 50.

I need the boat to be of distance 50, and as I move to the wall for it to decrease to 0. Then do an if(distance<0) statement for collision.

Am I accidnetly calculating the character position?

Should I rearrange it to something like p.x-s*n.x-c.x? to give me the distance away from the wall?

Many thanks

Share this post


Link to post
Share on other sites
Advertisement
Off the top of my head: you don't say, but if your vector c is supposed to be the closest point in the plane to p, then c = p - s, s being a vector from the closest point in the plane to point p.

For your calc, c.x = p.x-s.x, etc.

Therefore, the distance from the point p to the plane is the magnitude of s.

if dot(s,N) > 0 (s and N pointing the same direction), then point p is on the "positive" side of the plane.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!