Sets physics body orientation in degrees (pitch/yaw/roll, activates dynamic bodies).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), pitch (X-axis rotation in degrees), yaw (Y-axis rotation in degrees), roll (Z-axis rotation in degrees).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
bodyHandleInt
pitchDouble
yawDouble
rollDouble
Returns
Void
Quick Summary
Sets physics body orientation in degrees (pitch/yaw/roll, activates dynamic bodies).
Takes bodyHandle (physics body from b3dCreatePhysicsBody), pitch (X-axis rotation in degrees), yaw (Y-axis rotation in degrees), roll (Z-axis rotation in degrees).
Returns nothing.
Technical Exegesis...
Sets physics body orientation in degrees (pitch/yaw/roll, activates dynamic bodies). Takes bodyHandle (physics body from b3dCreatePhysicsBody), pitch (X-axis rotation in degrees), yaw (Y-axis rotation in degrees), roll (Z-axis rotation in degrees). Returns nothing. Converts Euler angles to quaternion, sets Jolt body rotation instantly, activates dynamic bodies to recalculate collisions. Use for respawning, alignment, or manual orientation.
This function sets body rotation.
Sets physics body orientation in degrees (pitch/yaw/roll, activates dynamic bodies). Takes bodyHandle (physics body from b3dCreatePhysicsBody), pitch (X-axis rotation in degrees), yaw (Y-axis rotation in degrees), roll (Z-axis rotation in degrees). Returns nothing. Converts Euler angles to quaternion, sets Jolt body rotation instantly, activates dynamic bodies to recalculate collisions. Use for respawning, alignment, or manual orientation.
This function sets body rotation. Rotation angles: pitch (rotation around X-axis in degrees, positive = nose down, negative = nose up), yaw (rotation around Y-axis in degrees, positive = turn left, negative = turn right), roll (rotation around Z-axis in degrees, positive = lean left, negative = lean right). Euler to quaternion: degrees converted to radians (multiply by PI/180), Quat::sEulerAngles creates quaternion from Vec3(pitchRad, yawRad, rollRad), quaternion represents rotation in Jolt Y-up coordinate system (same as BambooBasic). Rotation update: sets body rotation instantly (no interpolation or simulation), does not affect angular velocity (body retains spin after rotation change), quaternion passed to Jolt SetRotation (replaces current orientation). Dynamic body activation: if body has mass>0 (dynamic body) activates with EActivation::Activate (forces collision recalculation, wakes sleeping body, updates broad-phase structure), prevents stale collision state after rotation (ensures collisions detected at new orientation). Static body behavior: if body has mass=0 (static body) uses EActivation::DontActivate (static bodies rarely rotate, no activation needed). Use cases: (1) Respawn alignment (reset object to upright orientation after falling), (2) Snapping (align object to grid or surface normal), (3) Cutscenes (orient objects for scripted events), (4) Editor tools (manually rotate physics objects), (5) Vehicle reset (flip car back onto wheels). Common patterns: reset upright b3dSetPhysicsBodyRotation(body, 0, 0, 0), align to surface b3dSetPhysicsBodyRotation(body, surfacePitch, surfaceYaw, 0), face direction b3dSetPhysicsBodyRotation(body, 0, targetYaw, 0). Typical usage: combine with b3dSetPhysicsBodyPosition for full transform reset, call with b3dSetPhysicsBodyAngularVelocity(body, 0, 0, 0) to stop spinning, use for respawn systems (position + rotation reset). Coordinate system: BambooBasic Y-up Euler angles (same as entity rotations), converted to Jolt quaternion (Jolt also uses Y-up), rotation order Roll-Pitch-Yaw (standard Euler convention). Angular velocity preservation: body angular velocity unchanged after rotation (spin retained, may cause unexpected behavior), reset separately if desired (b3dSetPhysicsBodyAngularVelocity(body, 0, 0, 0) for no spin). Collision detection: activation ensures collisions detected at new orientation (broad-phase updated, narrow-phase triggered), prevents rotated body clipping through geometry, may trigger collision callbacks if rotated into other objects. Entity sync: entity visual rotation not automatically updated (call b3dRotateEntity to sync visual and physics), physics system syncs entity TO physics each frame (not physics to entity for manual rotation), manually sync if visual should match rotation. Performance: O(1) operation (quaternion conversion and set), activation triggers broad-phase update (cheap), avoid rotating many bodies per frame (activation overhead). Quaternion precision: quaternion representation avoids gimbal lock (unlike pure Euler angles), smooth interpolation possible (though this function does instant set), normalized by Jolt (ensures unit quaternion). Validation: silently returns if g_physicsSystem not initialized, silently returns if bodyHandle not found in g_bodyHandleToBodyID, reads g_bodyCreationData to check if dynamic (mass>0 for activation). Activation reasoning: without activation rotated body may have stale collision state (old orientation in broad-phase), activation forces immediate update (prevents tunneling or clipping), wakes sleeping bodies (ensures physics active after rotation change). Sleeping bodies: dynamic bodies sleep when stable (auto-sleep saves CPU), rotation without activation leaves body asleep at old orientation (physics not updated), activation wakes body (re-enables collision and simulation). Related: b3dSetPhysicsBodyPosition sets position (combine for full transform), b3dSetPhysicsBodyAngularVelocity sets spin rate (reset to 0,0,0 for no rotation), b3dCreatePhysicsBody creates physics body, b3dRotateEntity sets entity visual rotation (sync with physics orientation).