POV-Ray : Newsgroups : povray.advanced-users : Point at a vector; angles for rotation on axes X and Y /w nonzero origin : Re: Point at a vector; angles for rotation on axes X and Y /w nonzero origi= Server Time
28 Jul 2024 12:23:54 EDT (-0400)
  Re: Point at a vector; angles for rotation on axes X and Y /w nonzero origi=  
From: Mike C
Date: 16 Aug 2005 14:35:01
Message: <web.430230a473034d4744365ed70@news.povray.org>
I believe I've found a solution, but if anyone has a better method, let me
know or post a message.

Requires 'include "transforms.inc"'.

    #macro Point_At_Trans_MyO(MOrigV,Target)
      translate -MOrigV
        #local Z = vnormalize(Target-MOrigV);
        #local X = VPerp_To_Vector(Z);
        #local Y = vcross(X, Z);
        Shear_Trans(X, Y, Z)
      translate MOrigV
    #end

Where positive Z is the front of the object (the part you want to face the
target), "MOrigV" is the vector of the object, and "Target" is the vector
you want to point at.


Post a reply to this message

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