Orientation TargetSpot like Target Camer

Good day.
In scene present
Target Camera - $Camera01 and Target Spot-$Spot01.
I need to orient $Spot01 like $Camera01
For position I use:

$Spot01.pos=$Camera01.pos
$Spot01.target.pos=$Camera01.target.pos

for rotation I use:

r = $Camera01.transform.rotationPart
rotate $Spot01 r

AND HAVE MISTAKE....

HELP!!!!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Any's picture

The second solution is good....

Barigazy, thank you....

Any's picture

No, thet is wronrg

If TargetSpot has rectangle shape(not circle), the mistake appears...
Cone of camera does not coincide with cone of spot....

barigazy's picture

solution #2

Or you can use controller values

lgt = $Spot01
cam = $Camera01
for i = 1 to 3 do
(
-- set light pos controler(track) value 
	lgt[3][1][i].track.value = cam[3][1][i].track.value 
-- set light target pos controler(track) value
	lgt.target[3][1][i].track.value = cam.target[3][1][i].track.value
)
-- set light "Roll_Angle" value
lgt[3][2].track.value = cam[3][2].track.value

Now you see that TargetLight and TargetCamera have roll angle (LookAt controller) float value. No need to use quat values.

bga

barigazy's picture

solution #1

Why don't you try only with transform

$Spot01.transform=$Camera01.transform
$Spot01.target.transform=$Camera01.target.transform

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.