After plugging in this script to my sprite, I try to press and hold my sprite against a cube wall that I made.
After a couple of seconds, my sprite would rotate and change its X,Y,Z positions over time as if it rotates like a flying card.
My sprite has a box collider and a rigidbody component.
Here is the script(written in C#):
`
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetAxisRaw("Horizontal") > 0.9)
{
transform.Translate(200 * Time.deltaTime,0,0);
}
else if (Input.GetAxisRaw("Horizontal") < -0.9)
{
transform.Translate(-200 * Time.deltaTime,0,0);
}
if (Input.GetAxisRaw("Vertical") > 0.9)
{
transform.Translate(0,200 * Time.deltaTime,0);
}
else if (Input.GetAxisRaw("Vertical") < -0.9)
{
transform.Translate(0,-200 * Time.deltaTime,0);
}
}
}
`