2 Quick Questions
by Gerardo Damian Fiorotto · in Torque 3D Professional · 03/02/2010 (5:20 am) · 2 replies
Hello guys, well yesterday i started my first project, im just a guy who knows how to do 3d and i want to start with torque. I read the entire document and i found that there are some very important points in the documentation that are missing. So i think this question will be the first of a whole.
1. Where can i found the codes for object movement? Translate, Rotate, Size
2. same thing, where can i found the codes for camera control, for example i want to add a new camera on the scene and attach it to one object.
Pretty sure this is some easy thing taht im missing, but i cant find it. ( always talking about the code and not the world editor. )
1. Where can i found the codes for object movement? Translate, Rotate, Size
2. same thing, where can i found the codes for camera control, for example i want to add a new camera on the scene and attach it to one object.
Pretty sure this is some easy thing taht im missing, but i cant find it. ( always talking about the code and not the world editor. )
#2
For object movement, you can experiment a bit from the console. First, you set a name from the editor to the object you want to move, lets say "Pepe".
Then open the console, and fool around a bit:
Ie: $PepesPosition could be "10 10 0".
03/02/2010 (6:54 pm)
@Gerardo, hey there, a bit more extended tips for a fellow countryman ;)For object movement, you can experiment a bit from the console. First, you set a name from the editor to the object you want to move, lets say "Pepe".
Then open the console, and fool around a bit:
// using global variables for experimenting purposes $PepesPosition = pepe.getPosition(); // pepe's position $PepesTransform = pepe.getTransform(); // pepe's transformThe position and transform are vector type values, each element separated by spaces.
Ie: $PepesPosition could be "10 10 0".
// This two lines will move Pepe 10 meters forward $PepesNewPosition = vectorAdd($PepesPosition, "0 10 0"); pepe.setTransform($PepesNewPosition);You can also play around with scales, as Rene say, in the same form: pepe.setSacale(number); default is obviously 1.
Associate Rene Damm
The general transformation framework is found in SceneObject (getTransform/setTransform, getScale/setScale, etc; sceneGraph/sceneObject.h|cpp). Other than that, the motion code for the different movable entities is in the respective classes like Player for most of the player controller code.
2.
Camera handling in Torque is a bit peculiar. It depends a little on what you want to achieve here. 1st and 3rd person views in Torque are not done through separate Camera objects which are basically used only for freeflight cams (when control object = camera).
You could mount a Camera object to another SceneObject (look at the mounting interface in SceneObject) but it depends on what this is for whether this makes sense.