# 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.

## 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 on other sites
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.

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632984
• Total Posts
3009713
• ### Who's Online (See full list)

There are no registered users currently online

×