I’m currently having a rigidbody be suspended in the air for a game that consists of ships, and not in space. But on Earth. How I am suspending the object in air at a constant is putting one line of code in the Update function. Although of course more of the Update function is being used as controls.
this.transform.position.y = shipAltitude;
shipAltitude has a integer of 20.
I have used force and velocity to override the Rigidbody stuff. When a control is pressed a boolean value “movement” is set to true, and when control is not in use. The variable is set to false. Though I set an if or else statement as this.
if (movement == false)
{
velocity = 0.0;
force = 0.0;
}
Right now I have the following variables in from above. I tried using ‘this.transform.position.x = xSet’ which the ‘xSet’ variable consisted of ‘transform.position.x’. Which of course didn’t really do anything when you think about it. Would magnitude override whatever is controlling the rigidbody?. Here’s an ideal of what the object is doing.
It has a box collider with a rigidbody. The ship is then colliding into a building or bridge and it slowly ricochets off and slowly drifts away from the building or bridge.