Hello! I am working on pirate roguelike game, I am using CREST Ocean system for a ocean and boats.
Here’s how my boat work: there is object called BoatSystem that controlls movement of a boat (it has a rigidbody and some other CREST components) and it’s basically just a long capsule. Then I have a model of my boat that uses script to follow my BoatSystem. Here is the script for it:
using UnityEngine;
public class FollowObjectWithOffset : MonoBehaviour
{
public Transform targetObject;
public Vector3 offset;
void FixedUpdate()
{
if (targetObject != null)
{
transform.position = targetObject.position + offset;
transform.rotation = targetObject.rotation;
}
else
{
Debug.LogWarning("Target Object not found!");
}
}
}
When I used custom character controller with rigidbody, I just made my player a child object for a boat model and it worked fine, but I didn’t like it, so I started using Kinematic Character Controller (https://assetstore.unity.com/packages/tools/physics/kinematic-character-controller-99131?srsltid=AfmBOorzdAILzbv2L-r2-oHW3wFo2xFWL-MNlgst9FZpcY7EpD5uZ3EM)
And now it doesn’t work at all. When my boat moves, my character just stays on the same place. How do I make him move with the boat?