I’m befuddled (again! surprise!).
I have a spaceship I want to constrain to the Z axis just like in the 2d gameplay demo (except this isn’t a platformer). Anyway, here’s what I’m doing, abridged for your clarity/convenience.
private Vector3 _position;
public void Start()
{
_position.x = transform.position.x;
}
public void FixedUpdate()
{
_position.x = transform.position.x;
_position.y = 0;
_position.z = 0;
transform.position = _position;
}
When the player collides, though, it goes spinning off in all directions as if the y/z were not being zeroed each update. So, I’m doing something wrong. But I can’t figure out what it is.
Help?!