Sets entity scale factors (modifies transform and rescales physics body if attached). Takes entity (entity handle), scaleX (X-axis scale factor), scaleY (Y-axis scale factor), scaleZ (Z-axis scale factor). Returns nothing. Validates entity exists, if physicsBodyHandle!=0 calls RescalePhysicsBody to resize collision shape, always sets entity.scale=XMFLOAT3(scaleX, scaleY, scaleZ), marks worldMatrixDirty=true to trigger matrix recalculation. Modifies entity visual scale and physics collision shape.
Sets entity scale factors (modifies transform and rescales physics body if attached). Takes entity (entity handle), scaleX (X-axis scale factor), scaleY (Y-axis scale factor), scaleZ (Z-axis scale factor). Returns nothing. Validates entity exists, if physicsBodyHandle!=0 calls RescalePhysicsBody to resize collision shape, always sets entity.scale=XMFLOAT3(scaleX, scaleY, scaleZ), marks worldMatrixDirty=true to trigger matrix recalculation. Modifies entity visual scale and physics collision shape.
This function sets entity scale for visual size and physics shape. Transform vs geometry: ScaleEntity modifies entity's transform matrix (affects rendering size), doesn't change mesh vertices (geometry unchanged), entity visually larger/smaller but mesh data identical. Contrast with b3dScaleMesh which scales vertices directly (permanent geometry change). Scale factors: 1.0 = original size (no scaling), >1.0 = larger (2.0 = double size), <1.0 = smaller (0.5 = half size), negative values = mirroring (flips along axis, may break lighting/winding order). Non-uniform scaling: scaleX/Y/Z can differ (stretch/squash along axes), uniform scaling: all factors equal (proportional resize, preserves shape). Physics integration: checks entity.physicsBodyHandle!=0 (non-zero means physics body attached), calls RescalePhysicsBody(physicsBodyHandle, scaleX, scaleY, scaleZ) to resize collision shape (box, sphere, capsule dimensions updated), collision shape matches visual size (prevents collision mismatch), always updates visual scale (entity.scale) regardless of physics body presence. Note: unlike Position/Rotate which route to physics exclusively, Scale updates both physics and visual simultaneously. WorldMatrix dirty flag: setting scale marks worldMatrixDirty=true, triggers UpdateEntityWorldMatrix() during next render pass, recalculates matrix: WorldMatrix = Scale * Rotation * Translation, scale applied first (before rotation/translation). Use cases: (1) Resize objects dynamically (power-ups grow, dying enemies shrink), (2) Vary object sizes (procedural generation, size randomization), (3) Squash-and-stretch animation (cartoony effects, impact deformation), (4) Level-of-detail (scale down distant objects), (5) Mirror objects (negative scale for symmetry). Common pattern: b3dScaleEntity(entity, 2, 2, 2) for uniform doubling, b3dScaleEntity(entity, 1, 0.5, 1) for vertical squash. Coordinate system: scale factors apply in local space (along entity's own axes before rotation applied), world space size = local scale * parent scale (hierarchy multiplies scales). Parent-child relationships: scaled entity scales children with it (children inherit parent scale), children's local scales combine with parent scale for final world scale. Scale hierarchy: scale factors multiply down hierarchy (parent scale=2, child scale=2 -> child world scale=4). Performance: scale setting is O(1) operation for visual, physics rescaling more expensive (shape recreation), matrix recalculation deferred until render (lazy evaluation). Physics performance: RescalePhysicsBody may recreate collision shape (depends on shape type), compound shapes rescale all child shapes (expensive for complex shapes). Bounding volumes: scaled entities have bounding spheres/boxes scaled accordingly (affects frustum culling), bounding radius multiplied by largest scale factor. Typical usage: set scale at creation for initial size, animate scale for effects (spawning, dying, pulsating), keep scale uniform for physics objects (non-uniform scale complicates physics). Validation: invalid entity handles silently ignored. Zero/negative scale: zero scale makes object invisible (infinitely small), negative scale mirrors (may break rendering, use with caution). Related: b3dScaleMesh modifies vertices directly (permanent geometry change), RescalePhysicsBody rescales collision shape, b3dGetEntityScaleX/Y/Z for querying scale, UpdateEntityWorldMatrix recalculates world matrix.