ScriptSpot

Forum topic · General Scripting

Orientation TargetSpot like Target Camer

By Any · 2013-01-25

Description

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 (4)

The second solution is good....

Any · 2013-01-25

Barigazy, thank you....

No, thet is wronrg

Any · 2013-01-25

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

solution #2

barigazy · 2013-01-25

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.

solution #1

barigazy · 2013-01-25

Why don't you try only with transform

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