POV-Ray : Newsgroups : povray.advanced-users : How do you rotate an object to face the origin? : Re: How do you rotate an object to face the origin? Server Time
28 Jul 2024 22:31:41 EDT (-0400)
  Re: How do you rotate an object to face the origin?  
From: Rich
Date: 16 Dec 2003 16:16:50
Message: <Xns9453914531EC4spammindspringcom@204.213.191.226>
"Chris B" <c_b### [at] btconnectcom> wrote in
news:3fdf72ea$1@news.povray.org: 
> Looking at what you want to do you will need to work with
> 90-targetAngle, which you actually get if you take the arctan of x /
> z. You will then need to compensate for the direction that your object
> is pointing in when you defined it, so if it points at -z to start
> with you don't need to compensate at all and you can use rotation =
> atan2d(x1,z1); If your object points out along +z you will need to add
> or subtract 180. e.g. rotation = 180 + atan2d(x1,z1);
> If it's +x then add 90, for -x subtract 90 (I think!!).

Swapping the x and z values in the atan2d formula did the trick.  Thank you 
very much!

Rich


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.