- Home /
Question by
konrado701 · Feb 05, 2018 at 08:17 PM ·
rotationmovement script
How to do Controls like in Cubiques game
How to do player controls like in Cubiques game where when you swipe than cube rotate and moves at the same time. I have a Swipe function which is a bool. This is my code so far.
static public Rigidbody rb;
public Swipe swipeControls;
void Update()
{
if (GroundedRight() && swipeControls.swipeRight)
{
rb.MovePosition(rb.position + transform.right);
}
if (GroundedLeft() && swipeControls.swipeLeft)
{
rb.MovePosition(rb.position - transform.right);
}
if (GroundedUp() && swipeControls.swipeUp)
{
rb.MovePosition(rb.position + transform.forward);
}
if (GroundedDown() && swipeControls.swipeDown)
{
rb.MovePosition(rb.position - transform.forward);
}
}
Comment
Your answer