How To Make A 2D Cube Rotate And Pull Itself?

Hello Everyone!
I am about ready to start developing a simple game for PC and Android. I have a question, however. I want the player to be a 2D square. The game works by the player pressing a key, and the the square starts rotating 90 degrees, waiting a moment, and then turning again. However, I want the actual movement of the turning to “pull” the player along. I don’t want him to just move and the same speed to make it look as if his rotating is pulling him. This is important, cause all the gameplay is based around those physics of him rotating.
Thanks in advance!
Calvin

It can be done by animation. You can rotate it at whatever angle you want, and at whatever speed you want.

Remember, though, I need it to actually use physics to pull itself. Thanks Anyhow!

If Attach a rigidbody2D and a box collider2D to the same object then you rotate it using physics with this script

using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour {

    // Use this for initialization
    void Start () {
  
    }
  
    // Update is called once per frame
    void FixedUpdate ()
    {
        GetComponent<Rigidbody2D>().AddTorque(-Input.GetAxis("Horizontal") * 5);
    }
}

Now you will see the cube will spin and pull its self along but slips alot while it is doing this

so next you right click in the project pane and look for physics2d material and crate one call what what you want then for the friction set it high so like 20 this will stop the slipping and have bounce to 0

the drag that material into the 2D box collider where it says Material

this should have the behaviour you want as a start.

1 Like

Thanks! I still have to test it out, but thanks for the help!!!