View Full Version : Plane Rotation/LookAt Problem
02-17-2005, 04:43 PM
suppose i have 3 point helpers A,B and C (which determines a plane in 3d space), and I animate all 3 of them randomly in all axes, x,y and z.
Now I create a plane 'P' (or any 2d geometry).
How can I keep this plane 'P' always oriented exactly to the plane determined by the points A, B and C?
I donot want to go into vertex or any subobject mode... need to solve it with a rotation/position controller or script.
What I tried till now :
I have tried using a lookat constraint, using all 3 points as targets, but gives strange results .... maybe I am using the parameters wrongly ...
never got to fully understand the lookAt parameters well ... too confusing.
I have come accross this problem many a times, but never got a foolproof solution ....
has any one in a similar situation come to a solution?
any suggestions welcome
02-18-2005, 12:23 AM
I'm not sure about what do you wish :
do you want that your plane looks at the center of the triangle ?
do you want that your plane looks in the same direction as the triangle ?
A good place to use a Transform Script controller...
*Create 3 Point Helpers
*Create a Plane
*Go to Motion tab, select the Transform controller track, assign Transform Script
Enter the following script:
p1 = $Point01.pos
p2 = $Point02.pos
p3 = $Point03.pos
v1 = normalize (p2-p1)
v2 = normalize (p3-p1)
nv1 = cross v1 v2
nv2 = cross nv1 v1
matrix3 v1 nv2 nv1 ((p1+p2+p3)/3)
Close the Script controller dialog. Move the points around - the plane object should stay aligned to the plane defined by the 3 points and stay centered at the mid-point of the 3 point positions.
02-19-2005, 07:35 PM
WOW ... that was awesome .... thanks Bobo !
I had completely forgotten that there is something called a transform controller ....
( http://www.cgtalk.com/images/icons/icon10.gif not that if I had remembered, I would have figured out what u told me! http://www.cgtalk.com/images/icons/icon10.gif )
hi prettyPixel, I wanted the plane to be parallel to the triangle defined by the 3 points,
i did not want the plane to look at the center of the triangle ....
thanks again bobo, that was a big help.....
02-19-2006, 08:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.