Target expression with up vector
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/12/2011 at 16:23, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C.O.F.F.E.E ; PYTHON ;---------
From the Target node in Xpresso, I got the target expression.
But I would like to know if there is any expression that would return the rotation of the object to make it point to a target and also consider an upvector, just like the Target tag has.
Also, is there any such thing already in the python SDK? I searched by "target" and "upvector" and I got no results -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/12/2011 at 08:57, xxxxxxxx wrote:
I could figure out how to make a Target expression in python:
vec3=(pos2-pos1).GetNormalized()
vec2=vec3.Cross(c4d.Vector(0,1,0)).GetNormalized()
vec1=vec3.Cross(c4d.Vector(1,0,0)).GetNormalized()
new_mx=c4d.Matrix(pos1,vec1,vec2,vec3)But, how could I make it also respond to an up vector?
I mean, I have the matrix applied to point pos1 , with its Z axis pointing to point pos2.
How could I make its Y axis, for example, also point in the general direction of a third point, pos3 ? -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/12/2011 at 07:02, xxxxxxxx wrote:
Howdy,
You'd do the same thing to get a vector to pos3 as you did to get a vector to pos2. This would only be a temporary vector so you can use the cross product to determine vec1. Once you get vec1 you use it with vec3 to square up vec2. this will give you an affine (square) matrix.
Remember this about matrix XYZ axes:
xAxis = yAxis cross zAxis
yAxis = zAxis cross xAxis
zAxis = xAxis cross yAxisAdios,
Cactus Dan