Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Object To Position Sliding

$
0
0
I am using a fairly simple script to jump the top part of an object to the bottom part (body to legs, in this example) #pragma strict var object1 : GameObject; var object2 : GameObject; function Start () { } function Update () { object1.transform.position = object2.transform.position; } I did this, because when using the Third-Person Controller on the totality of the prefab, it turns the body as well as the legs, where I only wanted the legs to turn. So I've placed two empty game objects, one containing the legs and the other containing the body apart from each-other so the rotation of the body is independent from the legs. I'm using the script above to make sure the body, which rotates towards the mouse, attaches to the legs, which provide the movement via the Third-person controller. My problem lies with when the object moves. Rotation of the body works great, and the legs work; however, with the script above, the body moves slightly slower than the legs when they're in motion. The body kinda "slides" when it should be exact on the position of the legs. How do I keep the body from doing this sliding and make sure that it updates to the game-object's position more accurately? Thank you!

Viewing all articles
Browse latest Browse all 171066

Trending Articles



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