Jump to content
  • Advertisement
Sign in to follow this  

Attach Objekt at the end of line

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

Hello! I want to do the following, but I am not completely sure how to do it: I have a line defined by two points each having (x,y,z) coordinates. Now I want to attach an object (e.g. a cone) at the end of the line in such a way that the central axis of the cone lies on the line. How can I do this the best way? Regards,

Share this post


Link to post
Share on other sites
Advertisement
ok, just some notes where I am at the moment:
Point A,B; Dir. Vector AB
1.) Calculate Rotation for each axis:
rot_x = acos(dotProduct(AB,Vector(1,0,0)))
rot_y = acos(dotProduct(AB,Vector(0,1,0)))
rot_z = acos(dotProduct(AB,Vector(0,0,1)))

2.) Rotate
3.) Translate to e.g. A

This works for some cases, but as the dotproduct is in the range between 0-180° rotation is not perfect.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!