- Home /
Question by
Dominic112 · Oct 13, 2021 at 02:19 PM ·
rotation2d-gameplayrotation axis2d rotationrotatetowards
Lookrotation for TwinStick Shooter
Hello,
iam trying to use two Axis for a twin stick shooter (2D).
Axis 1 (WASD) shall move the Character (with Rigidbody)
Axis 2 (IJKL) shall rotate the Character smooth in Shooting Direction Like pressing I and L let the character look top-Right and so on...
Even checking out google, i dont find a good solution to make the rotation smooth.
Hope you can help ;)
Thanks !
My Code so far:
void Start() { rb = GetComponent(); animator = GetComponent(); }
// Update is called once per frame
void Update()
{
move.x = Input.GetAxisRaw("HorizontalMove");
move.y = Input.GetAxisRaw("VerticalMove");
actionDir.x = Input.GetAxisRaw("HorizontalAction");
actionDir.y = Input.GetAxisRaw("VerticalAction");
}
private void FixedUpdate()
{
rb.MovePosition(rb.position + move * moveSpeed * Time.deltaTime);
}
Comment
Your answer
Follow this Question
Related Questions
Having trouble rotating a turret 1 Answer
Enemy Rotation AI 0 Answers
How to find or compute or look for overall/max RPM by simply checking for rotation? 1 Answer
Quaternion LookRotation issue 0 Answers