- Home /
Flip sticky pad as if "rolling"
Hello!
I'm trying to figure out how to make a box that is roughly the shape of a sticky note pad flip as if rolling. It starts standing with the skinny edge up. I can make it roll left and right on the skinny edges fine, but when it falls flat, I can't figure out how to apply force to the object to get it to flip up on the skinny edge again.
Currently, my object falls flat and slides along the ground plane. This is what I've got so far. (Please keep in mind that I'm fairly new to scripting, so I'm sure this is a hot mess.)
public float speed;
public float backwardsSpeed;
public float upSpeed;
private Rigidbody rb;
void Start () {
rb = GetComponent<Rigidbody> ();
}
void FixedUpdate () {
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
rb.AddForceAtPosition (((transform.forward * -1) * backwardsSpeed), transform.position);
rb.AddRelativeForce (Vector3.up * upSpeed);
}
What I'm trying to do is to apply force to the end of the object that's closest to the camera.
What's a good way to do this? This is for a silly experiment, so if it looks weird, that's fine.
Thanks for looking!
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Similar movement to a game (look description) 1 Answer
Rotating an Arrow 2 Answers