# is this correct?

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

## Recommended Posts

In the context of a ray colliding with a plane: I know that this is mathematically correct: Pn = plane normal Po = plane origin (any point of the plane works but the origin is calculated already Rs = ray start Rd = ray direction t=(Pn.(Po - Rs)) / (Pn.Rd); but is this correct: vector at collision point = ray_start +(ray_normal * t) ?

##### Share on other sites
Do you mean the point of intersection of the ray and the plane? That will be given by Rs + t * Rd.

##### Share on other sites
should rd be normalised?

my problem is as described in this thread:

http://www.gamedev.net/community/forums/topic.asp?topic_id=451622

but i didnt get any answers, possibly because my question was too esoteric, so i have simplified it here. Im getting some wierd results with the exact formulae that i have stated above, such as the contact point being behind the start of the ray, or the contact point being on the ray, but slightly above the surface:
              /             1            /-------====2=====--------          /         /        /       /

--- is the plane
=== is the visible polygon on that plane

/
/ is the ray

1 is where the intersection is being calculated.
2 is where it should theoretically be.

I get different, but always wrong, results depending on what i do, and right now im getting the intersection point behind the start of the ray.

im calculating the plane from a triangle in 3-space

my formulae are as follows:

plane equation:
v1, v2, v3 = vertices of the triangle

origin=v1
d=cross_product(v1-v2,v1-v3)

intersection point:
t=distance along ray
Pn = plane normal
Po = plane origin (any point of the plane works but the origin is calculated already
Rs = ray start
Rd = ray direction
t=(Pn.(Po - Rs)) / (Pn.Rd);

intersection point:
contact_point = r->start +(r->direction*t);

##### Share on other sites
No problem, I fixed it myself.
I wasnt calculating the plane origin, so it was defaulting to 0.
I realised this when i decided to exaustatively visualise every piece of information in the test, and saw that the plane origin didnt touch the plane.

Thats why the intersection point was always a constant (and wrong) distance from the plane.
Any way, thanks d00fus for confirming that my formulae were correct, thus narrowing down my search.

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5

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

• Total Topics
632985
• Total Posts
3009723
• ### Who's Online (See full list)

There are no registered users currently online

×