UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

62 lines (30 loc) 1.15 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [RigidBody](./server.rigidbody.md) &gt; [setRotation](./server.rigidbody.setrotation.md) ## RigidBody.setRotation() method Sets the rotation of the rigid body. **Signature:** ```typescript setRotation(rotation: QuaternionLike): void; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> rotation </td><td> [QuaternionLike](./server.quaternionlike.md) </td><td> The rotation of the rigid body. \*\*Category:\*\* Physics </td></tr> </tbody></table> **Returns:** void ## Remarks \*\*Coordinate system:\*\* Identity rotation (0,0,0,1 quaternion) means facing -Z. For Y-axis rotation only (yaw), use: `{ x: 0, y: sin(yaw/2), z: 0, w: cos(yaw/2) }`<!-- -->. A yaw of 0 faces -Z, positive yaw rotates counter-clockwise when viewed from above. This sets rotation immediately. For smooth rotation, use angular velocity (dynamic) or next kinematic rotation (kinematic).