So I'm trying to figure out this idiotically simple code, but it just isn't working. I'm trying to get an object to flip over (or simply to move to begin with) when F is pressed. Originally I had it to flip with animation, but I'm not satisfied with how it looks like, and I thought flipping it with gravity would result in more realistic result.
I've tried to google a solution multiple times but nothing seems to work. My object isn't kinematic and it is not colliding with anything. So yeah. Here's the part of the code I'm trying to edit;
if (Input.GetButtonDown ("F")) {
//animation.Play ("flip");
rigidbody.AddForce(-transform.forward * 500);
rigidbody.useGravity = true;
}
Note: I'm not a total newbie with coding but I don't consider myself being particularly good at it either. Any help would be appreciated!
↧