Question by
AibNihan · Feb 07, 2018 at 10:19 AM ·
unity5touch controlscrossplatform
How to smoothly rotate to certain directions using CrossPlatformInputManager axis
I Actually I Fount My Problem Solution Here Unity Answer
But Here Is 3d Solution and I Want 2d AnyOne Help Me ???
My Code
void FixedUpdate () {
Vector2 moveVec = new Vector2(CrossPlatformInputManager.GetAxis("Horizontal"), CrossPlatformInputManager.GetAxis("Vertical")) * moveForce;
myRB.AddForce(moveVec);
if (moveVec != Vector2.zero)
{
transform.rotation = Quaternion.LookRotation(Vector3.forward , moveVec);
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity steer wheel on touch button press using CrossPlatformInputManager 0 Answers
How can I detect a touch on a custom button and object in Unity3d 1 Answer
Converting from old multiplayer with RPC and master server to new networking system (Unity 5.3) 0 Answers
Xcode7.3 iPad Simulator Failure 0 Answers