Sign in to follow this  

Point a to point b

This topic is 3726 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

Im trying to move a line from a point to another, So far i've been moving items using normalize(destination - source) then just added that to the position, And extracting the y-rotation by modding it with 1. But the results are inaccurate at best, items facing 'more or less' the right direction, it`s been okay up until now. But moving a line in this way requires accuracy, supposedly simulating a laser beam, which is hitting way off the target. Am i missing something fundemental here?

Share this post


Link to post
Share on other sites
Quote:
Original post by marius1930
And extracting the y-rotation by modding it with 1.

Everything's fine up to here.

You should create the normalised displacement vector, as you are, and scalar-multiply it before adding it to the position. The factor by which you multiply will determine the distance travelled, with 0 being at the source and 1 at the destination. Intermediate values will be directly between the two points, and those outside the interval [0, 1] will be along the same line but one one of the 'far' sides.

Admiral

Share this post


Link to post
Share on other sites
I think this is more suited to the 'Maths & Physics' forum - moved for any further discussion [smile]

Cheers,
Jack

Share this post


Link to post
Share on other sites
Was a mixup of object and world space, but for a better rotation i'd have to start using tan/etc, dig up the math book.

Or are there any convinient ways in DX to do it?

Share this post


Link to post
Share on other sites

This topic is 3726 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.

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