Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Flipping an object using AddForce?

$
0
0
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!

Viewing all articles
Browse latest Browse all 1264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>