for example player sit down on the ship and follow the ship movement. by the way, I added ship collider on it, so i have added smooth follow script to FPS and set my ship as the target. however, the player is still moving outside the ship, which is not what i want. what i want is when player within/inside the ship, player is not able walking out of the ship and it does follow the ship movement.
here is the script that i have got for ship movement:
var pointB : Transform;
private var pointA : Vector3;
var speed = 1.0;
function Start () {
pointA = transform.position;
while (true) {
var i = Mathf.PingPong(Time.time * speed, 1);
transform.position = Vector3.Lerp(pointA, pointB.position, i);
yield;
}
}
i created a cube as my pointB target in this script.