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
Get New point from a 3D Vector
If 'direction' is unit length, that equation will give you a point distance units from Origin in the direction of direction. 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.
More generally, the distance will be in units of |distance|, which will be 1 if 'distance' is unit length.
If 'direction' is unit length, that equation will give you a point distance units from Origin in the direction of direction. 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.
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.
Are you getting the right results? If not, perhaps you could post the relevant code so we can take a look.
Are you getting the right results? If not, perhaps you could post the relevant code so we can take a look.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement