I’m trying to have a camera follow an object floating in Ocean 3v. Basically a 3rd person view of a boat driving through the water. I’ve come up w/ this but it doesn’t do anything and I’m not certain why.
var Structure: Transform;
var CameraOffsetX: double;
var CameraOffsetZ: double;
private var Spread: Transform;
function Update () {
var follow = GetComponent(Transform).Transform;
Spread.position.x = Structure.position.x + CameraOffsetX;
Spread.position.z = Structure.position.z + CameraOffsetZ;
follow.position = Spread.position;
}
The reason I’m moving the camera instead of attaching a camera as a child is because Ocean 3v nicely follows the main camera making it look like you’re driving through the water. The game plan is to use the bouyancy script as it hits a wave while having the camera follow the boat. Plus I want the boat to rock w/o the camera rocking as well.
If there’s a better way to do this I’m all ears.