TFormVector or MoveEntity?
Blitz3D Forums/Blitz3D Beginners Area/TFormVector or MoveEntity?
| ||
I don't understand the difference between TFormVector and its components: TFormedX(), TFormedY(), TFormedZ(), and MoveEntity. They seem to function the same.. Anyone care to explain the difference? |
| ||
TFormVector simply transforms/converts a 3D vector from one coordinate space into another. I can't see what that has to do with MoveEntity, specifically. |
| ||
So, the TForm family is just about manipulating vectors? The MoveEntity is about assigning a position to a 3D Entity, so we can conclude that TForm functions can derive values to assign to the MoveEntity comand, insofar as knowing WHERE to Move the entity to? |
| ||
So, the TForm family is just about manipulating vectors? The MoveEntity is about assigning a position to a 3D Entity, so we can conclude that TForm functions can derive values to assign to the MoveEntity comand, insofar as knowing WHERE to Move the entity to? Pretty much for Tformvector & Tformnormal although tformvector can tell you how much an entity is to be moved, not it's new position. You would use tformpoint for that. Tformvector 0,0,1, PLAYER , 0 translateentity PLAYER , tformedx(), tformedy(), tformedz() is the same as .... Moveentity PLAYER , 0, 0, 1 To be honest I use the tform commands all the time AFAIK they're some of the most useful commands in B3d. Stevie |
| ||
tformpoint rawks |
| ||
Stevie G: Pretty much for Tformvector & Tformnormal although tformvector can tell you how much an entity is to be moved, not it's new position. You would use tformpoint for that. Tformvector 0,0,1, PLAYER , 0 translateentity PLAYER , tformedx(), tformedy(), tformedz() is the same as .... Moveentity PLAYER , 0, 0, 1 To be honest I use the tform commands all the time AFAIK they're some of the most useful commands in B3d. Why use more when less wil do the same job? The Tform lines are two in number, with more info, and 'way longer than the much simpler MoveEntity command's line. So, why use the longer form? Just asking..... |
| ||
You wouldn't use it in that situation. That was just a simple example highlighting the difference between the commands. |
| ||
A more practical example would be aligning single surface particles to the camera. Using moveentity for this would be a pain in the rear ...Function PARTICLEupdate() If ( Not PARTICLEon ) Return s = GetSurface( PARTICLEmesh , 1 ) For p.particle = Each particle If p\Life > 0 ;life / movement p\Life = LIMIT( p\Life - p\fade ,0 , 1.0 ) VECTORadd( p\Position , p\Velocity ) ;uv's u1# = PARTICLEuvMulti * ( 7.0 - Floor( p\Life * 8.0 ) ) +.5/128.0 u2# = ( u1 + PARTICLEuvMulti ) v1# = PARTICLEuvMulti * p\ID v2# = vs + PARTICLEuvMulti ;face the camera TFormVector -p\size,0,0, Camera , 0 xx# = TFormedX() xy# = TFormedY() xz# = TFormedZ() TFormVector 0,-p\size,0,Camera, 0 yx# = TFormedX() yy# = TFormedY() yz# = TFormedZ() For l= 0 To 3 u# = u2 * ( l=1 Or l=2 ) + u1*( l = 0 Or l = 3 ) v# = v2 * ( l > 1 ) + v1 * ( l < 2 ) mx# = ( l > 1 ) - ( l < 2 ) my# = ( l > 0 And l < 3 ) - ( l=0 Or l = 3 ) x# = p\Position\x + xx * mx + yx * my y# = p\Position\y + xy * mx + yy * my z# = p\Position\z + xz * mx + yz * my VertexCoords s , p\Vertex+l , x, y, z VertexTexCoords s, p\Vertex+l , u , v VertexColor s , p\Vertex + l , p\r,p\g,p\b, p\Life Next EndIf Next End Function |