Tformed?

Blitz3D Forums/Blitz3D Beginners Area/Tformed?

Cubed Inc.(Posted 2010) [#1]
Can someone explain to me what Tformed is and it's purpose? I don't understand it very well.

Last edited 2010

Last edited 2010


Warner(Posted 2010) [#2]
An entity can be scaled, rotated and translated. If you want to do the same thing with a point (x,y,z) then you can use TFormPoint.
It will scale/rotate/translate this point in the same way as the entity.
For instance: if you have a point (0, 0, -5) -> front, and you use TFormPoint on an entity that is rotated 90 degrees, you end up with a point (-5, 0, 0) -> left
You can use the command to find out where a 3d point is in relation to an entity. The most common usage would be transforming vertex coords to world coordinates.



Matty(Posted 2010) [#3]
It's useful for transforming coordinates between one object's world space and another object's world space.

For example, you may have a car and wish to know if another object like a tree lies directly ahead of the car's front (perhaps to signal a warning of an impending collision!) - you would use any of the tform commands to tform the tree's position relative to the car's position from world space to the car's space. If the tformedz() value was positive then the tree would sit in front of the car, while if it was negative it would sit behind.


jhocking(Posted 2010) [#4]
Expanding on his example, think about the Z direction for the car. Now think about the Z direction for the world. At first the car's Z direction and the world's Z direction are the same, but as soon as the car turns then the coordinate systems are different.

A point at, say, (0, 0, 1) in the car's coordinate space has different coordinates from that same location in the world coordinate space. If the car was facing left for example, down the world's X axis, then that point is (-1, 0, 0) in the world coordinate system. TFormPoint is used to determine what the world coordinates are.


Thinking about the camera facing situation I brought up in the other thread, let's say the camera is turned to the left and facing straight down the world's X axis. Now the player hits left on the controls, so you want to move in -X from the camera's direction. From the perspective of the world, that direction would be -Z. TFormVector is used to figure that out.

Last edited 2010