| %YAML 1.1 |
| %TAG !u! tag:unity3d.com,2011: |
| --- !u!114 &11400000 |
| MonoBehaviour: |
| m_ObjectHideFlags: 0 |
| m_CorrespondingSourceObject: {fileID: 0} |
| m_PrefabInstance: {fileID: 0} |
| m_PrefabAsset: {fileID: 0} |
| m_GameObject: {fileID: 0} |
| m_Enabled: 1 |
| m_EditorHideFlags: 0 |
| m_Script: {fileID: 11500000, guid: 4510294d23d964fe59443526f1ca7c4b, type: 3} |
| m_Name: Boat Movement |
| m_EditorClassIdentifier: |
| m_displayName: Boat Movement |
| m_hierarchyName: Boat Movement |
| m_context: {fileID: 11400000, guid: 2b06e806aa39fba45b1e3375fc6cd3e0, type: 2} |
| m_markdownFile: {fileID: 0} |
| m_priority: 1008 |
| m_overrideMarkdownText: '# Boat Movement |
| |
| |
| ## Overview |
| |
| |
| In North Star, |
| the boat is essential. It must move smoothly, turn, and interact with the ocean |
| while allowing free player movement onboard. We explored several methods to achieve |
| this. |
| |
| |
| ## Movement Approaches |
| |
| |
| ### True Movement |
| |
| |
| Initially, the |
| boat was a kinematic rigid body controlled by scripting, with objects physically |
| on it. This caused hand tracking and physics issues, so we abandoned this method. |
| |
| |
| ### |
| Move the World |
| |
| |
| We considered moving the environment around the boat instead |
| of the boat itself. However, this complicated persistent objects outside the |
| boat, so we did not pursue it. |
| |
| |
| ### Fake Movement |
| |
| |
| We adopted a "fake |
| movement" system. The boat''s visual position updates before rendering and resets |
| afterward. This prevents physics issues, avoids dragging objects with the boat, |
| and eliminates the need to move the world (ocean, islands, sky, reflections, |
| etc.). We developed helper functions for transforming between world space and |
| "boat space." |
| |
| |
| #### Relevant File |
| |
| - [Fake Movement](../Assets/NorthStar/Scripts/Ship/FakeMovement.cs) |
| |
| |
| ## |
| Rocking and Bobbing |
| |
| |
| To simulate ocean movement, we implemented a procedural |
| noise system to make the boat rock and bob. The effect scales with boat speed, |
| influenced by wind direction and sail angle. We tested a more realistic wave-height |
| and momentum-based system but replaced it for better player comfort and direct |
| control. |
| |
| |
| ## Reaction Movement |
| |
| |
| We scripted specific boat movements |
| for special events, like waves hitting the boat or creature attacks, using the |
| timeline. |
| |
| |
| ### Relevant Files |
| |
| - [BoatMovementAsset](../Assets/NorthStar/Scripts/Wave/BoatMovementAsset.cs) |
| |
| - |
| [BoatMovementBehaviour](../Assets/NorthStar/Scripts/Wave/BoatMovementBehaviour.cs) |
| |
| - |
| [BoatMovementMixerBehaviour](../Assets/NorthStar/Scripts/Wave/BoatMovementMixerBehaviour.cs) |
| |
| - |
| [BoatMovementTrack](../Assets/NorthStar/Scripts/Wave/BoatMovementTrack.cs) |
| |
| - |
| [WaveControlAsset](../Assets/NorthStar/Scripts/Wave/WaveControlAsset.cs) |
| |
| - |
| [WaveControlBehaviour](../Assets/NorthStar/Scripts/Wave/WaveControlBehaviour.cs) |
| |
| - |
| [WaveControlTrack](../Assets/NorthStar/Scripts/Wave/WaveControlTrack.cs) |
| |
| |
|  |
| |
| |
| ## |
| Comfort Settings |
| |
| |
| To ensure player comfort, procedural motion is directly |
| controlled, allowing magnitude adjustments. A comfort option locks the horizon |
| angle, keeping the player upright as if they had perfect "sea legs." This stabilizes |
| the horizon and prevents motion sickness. |
| |
| |
| ```cs |
| |
| var boatRotation = |
| BoatController.Instance.MovementSource.CurrentRotation; |
| |
| CameraRig.rotation |
| = Quaternion.Slerp(Quaternion.identity, Quaternion.Inverse(boatRotation), GlobalSettings.PlayerSettings.ReorientStrength) |
| * CameraRig.parent.localRotation; |
| |
| ``` |
| |
| *(from [BodyPositions.cs](../Assets/NorthStar/Scripts/Player/BodyPositions.cs#L241-L242))* |
| |
| |
|  |
| |
| ' |
| m_overrideMarkdownRoot: .\Documentation/ |
|
|