TForm Functions

Blitz3D Forums/Blitz3D Programming/TForm Functions

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.


They will return the original mesh data, so no matter if you Rotate/Scale and Move the entity, they will keep returning the same values



Not strictly true. If you use Scaleentity the transformations will be scaled accordingly.

The tform commands are probably the most useful in the whole blitz command set imo so you should take the time to get used to them.

There are far more and better uses for these commands though. One thing I use them for is in simulating friction relative to a tire which is attached to a vehicle for example, the direction the tire is pointing and it's velocity vector are generally going to differ/

What the following does is convert a global velocity vector into the tire entities local coordinate space. From there you can simulate a different friction on each axis, relative to the direction/rotation of the tire. As you can see I reduce the speed by half in the direction perpendicular to the tire direction but not so much for the velocity component facing forward relative to the tire rotation. The next step is to convert the resulting velocity vector back into world/global coords.

TFormVector p\Velocity\x, p\Velocity\y , p\Velocity\z , 0 , TIRE
p\Velocity\x = TFormedX() * .5
p\Velocity\y = TFormedY() 
p\Velocity\z = TFormedZ() * .99
TFormVector p\Velocity\x , p\Velocity\y , p\Velocity\z , TIRE , 0