I want to make smooth movements for my characters that have rigidbodies. I tried rigidbody.AddForce
, but it’s not the type of movement I want. It’s drags too much, if you know what I mean. So I decided to check out rigidbody.MovePosition
. It’s exactly what I’m looking for, but I can only do one direction or the other doesn’t work. Here’s what I have:
//Side-to-Side Movement
rigidbody.MovePosition(transform.position + Camera.main.transform.right*mh*Time.deltaTime*7);
//Forward-Backward Movement
rigidbody.MovePosition(transform.position + Camera.main.transform.forward*mv*Time.deltaTime*7);
mh and mv are horizontal and vertical variables that correspond with controller inputs (left & right is mh, up & down is mv). The problem is that horizontal code (which comes first) is being cancelled out by the vertical (last). If I were to switch the order, horizontal would cancel out vertical. How would I make it so that both directions work?
Thanks in advance.