Jump to content
  • Advertisement
Sign in to follow this  
marius1930

Point a to point b

This topic is 4058 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
Advertisement
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!