Transforms vector from src_entity space to dest_entity space (stores in g_lastTFormedResult, retrieve with b3dTFormedX/Y/Z).
Takes x/y/z (vector direction in src space), src_entity (source coordinate system, 0=world space), dest_entity (destination coordinate system, 0=world space).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
xDouble
yDouble
zDouble
src_entityInt
dest_entityInt
Returns
Void
Quick Summary
Transforms vector from src_entity space to dest_entity space (stores in g_lastTFormedResult, retrieve with b3dTFormedX/Y/Z).
Takes x/y/z (vector direction in src space), src_entity (source coordinate system, 0=world space), dest_entity (destination coordinate system, 0=world space).
Returns nothing.
Technical Exegesis...
Transforms vector from src_entity space to dest_entity space (stores in g_lastTFormedResult, retrieve with b3dTFormedX/Y/Z). Takes x/y/z (vector direction in src space), src_entity (source coordinate system, 0=world space), dest_entity (destination coordinate system, 0=world space). Returns nothing.
Transforms vector from src_entity space to dest_entity space (stores in g_lastTFormedResult, retrieve with b3dTFormedX/Y/Z). Takes x/y/z (vector direction in src space), src_entity (source coordinate system, 0=world space), dest_entity (destination coordinate system, 0=world space). Returns nothing. Negates input Y (user +Y to internal -Y), builds src rotation matrix (rotation only, no scale/translation), builds dest inverse rotation matrix, transforms vector from src to world to dest space using XMVector3TransformNormal, negates output Y (internal -Y to user +Y), stores in g_lastTFormedResult. Coordinate system conversion for directions.
This function transforms directions. Vector transformation: uses XMVector3TransformNormal (transforms direction without translation), applies rotation only (no scale or translation), use for directions/velocities (not positions). Transform pipeline: (1) Input vector in src space, (2) Negate Y (user to internal), (3) Transform to world space (multiply by src rotation), (4) Transform to dest space (multiply by dest inverse rotation), (5) Negate Y (internal to user), (6) Store result. Coordinate systems: src_entity=0 means world space (identity), dest_entity=0 means world space (identity), otherwise uses entity's rotation matrix only. Rotation only: vectors are directions (no position), only affected by rotation (not translation or scale), preserves vector length (no scale applied). Use cases: (1) Local to world directions (convert entity forward/up/right to world directions, src=entity dest=0), (2) World to local directions (convert world velocity to entity-relative velocity, src=0 dest=entity), (3) Velocity transformations (convert projectile velocity between spaces), (4) Normal transformations (convert surface normals, though b3dTFormNormal normalizes), (5) Physics forces (transform force vectors between coordinate systems). Common patterns: forward vector b3dTFormVector(0,0,1, entity, 0) converts entity forward to world direction, world to local b3dTFormVector(velX, velY, velZ, 0, entity) converts world velocity to local. Typical usage: get entity forward/up/right vectors in world space, convert world velocity to local for physics calculations, transform directions for attachment systems. Y-axis negation: input/output in user space (+Y up), internal calculations in DirectX space (-Y up), automatic negation both directions. Matrix construction: src rotation = BuildRotationMatrixYXZ(pitch, yaw, roll), dest inverse = inverse(rotation), matches GPU shader rotation order. Result retrieval: call b3dTFormedX/Y/Z() to get transformed vector components. Performance: O(1) matrix math (no scale/translation, one inversion), very fast, suitable for per-frame transforms. Invalid entities: src_entity or dest_entity=0 treated as world space (identity), invalid handles use identity (no rotation). Related: b3dTFormPoint transforms positions (includes translation/scale), b3dTFormNormal transforms normals (normalized result), b3dTFormedX/Y/Z retrieve transformed result.