Sign in to follow this  
EdwardVella

Get New point from a 3D Vector

Recommended Posts

Hello,
i want to make sure the equation i am using is correct.

Scenario:
I made a ray cast to retrieve the distance from a point of origin, with a given direction vector and with those two i have the new distance. In order to calculate the new distance.

is this equation correct.


New Vector = Origin + direction * distance

Share this post


Link to post
Share on other sites
If 'direction' is unit length, that equation will give you a point [i]distance[/i] units from [i]Origin[/i] in the direction of [i]direction[/i]. So if that's what you're after, then yes, that looks right.

More generally, the distance will be in units of |distance|, which will be 1 if 'distance' is unit length.

Share this post


Link to post
Share on other sites
[quote name='jyk' timestamp='1302691719' post='4797889']
If 'direction' is unit length, that equation will give you a point [i]distance[/i] units from [i]Origin[/i] in the direction of [i]direction[/i]. So if that's what you're after, then yes, that looks right.

More generally, the distance will be in units of |distance|, which will be 1 if 'distance' is unit length.
[/quote]

Let me expand on what i am doing, to make sure we are on par. I'm working with steering behaviours, and i need to check how far a "vehicle" is away from a wall. I need to get the 3 points in the green circles in terms of Vectors. Each line green, orange and blue are all direction vectors of type Vector 3D. the point of origin is a vector 3D point as well, the distance is a normal decimal number that i had retrieved using ray calculations.


[img]http://img814.imageshack.us/img814/5656/rectanglee.png[/img]

Share this post


Link to post
Share on other sites
[quote name='jyk' timestamp='1302720460' post='4798068']
Are you getting the right results? If not, perhaps you could post the relevant code so we can take a look.
[/quote]

right now im still building my code, i still need to compile it to give me a good value. hopefully by tomorrow i will get the code up and running. But i took a look at some other code of a similar project and my equation and that one matched.now i just need to check it out. will get back to you ASAP. thanks for all the help :)

EDIT: Sorry for the late reply, it works well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this