Quantcast
Channel: Questions in topic: "up"
Viewing all articles
Browse latest Browse all 104

When I use rigidbody.Moveposition, the object doesn't move accurately.

$
0
0
I've been using rigidbody.Moveposition for one of the objects in my game. It moves up for a set number of seconds, then moves back down for the same number of seconds, at the same speed. However, the object doesn't always move correctly. Sometimes it'll move higher than it should, but then move the right distance down, or vice versa. How can I make the movement more exact? This is the snippet of code I'm using to make it move: if(spinDirection == "up") { rigidbody.MovePosition(rigidbody.position + Vector3(0,30,0) * Time.deltaTime); } else if(spinDirection == "down") { rigidbody.MovePosition(rigidbody.position + Vector3(0,-30,0) * Time.deltaTime); }

Viewing all articles
Browse latest Browse all 104

Trending Articles



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