Zoom help.
by Simon Carlsson · in Torque Game Builder · 05/24/2010 (5:23 am) · 4 replies
Is it posible to make the camera zoom in when two object comes closer and zoom out when they go apart from eachother.
edit. please tell me also were to write the script.
edit. please tell me also were to write the script.
About the author
#2
05/25/2010 (5:22 am)
im sorry but im a beginner at this so the easiest way is what i need.
#3
so in onUpdate()
%this.object1Pos = %this.object1.getPosition();
%this.object2Pos = %this.object2.getPosition();
%distBetween = t2dVectorDistance(%this.object1Pos, %this.object2Pos);
then write an if statement.
if %distBetween > 1, set zoom to X
if %distBetween < 1, set Zoom to X3
etc etc.
05/25/2010 (9:51 am)
just get the positions of each and measure the distance in an onUpdate().so in onUpdate()
%this.object1Pos = %this.object1.getPosition();
%this.object2Pos = %this.object2.getPosition();
%distBetween = t2dVectorDistance(%this.object1Pos, %this.object2Pos);
then write an if statement.
if %distBetween > 1, set zoom to X
if %distBetween < 1, set Zoom to X3
etc etc.
#4
05/25/2010 (2:12 pm)
thank you^^
Torque Owner Kevin James