- Home /
2D Platformer physics rotation Movement script - How to roll/flip a square on his edges ?
Hi ! I wanna create a 2d platformer in wich the character is a square rolling/flipping on his edges in order to move (left or right). I tried animations... Didn't work as wanted. I tried physics scripting and I found problems :/
I've seen that Vector2 will make my character move on X or Y.
rb2d.velocity = Vector2.right * speed;
But I think sqrMagnitude would be better because my sqr need to move Horizontal and a bit vertical.
Vector2.sqrMagnitude;
vector2Magnitude;
There's Quaternion to evaluate angles mixed with MoveRotation or rotation.
Quaternion fromRotation;
Quaternion toRotation;
rb2d.MoveRotation(90);
And transform.PROPERTIES
transform.rotation;
transform.position;
I also found Space.World wich would make my square turn right even if he's upside down. Now, I tried several combinations but I dunno what really needed to make my sqr_movements script. Someone can help me plz ? :)
-Niaka
https://docs.unity3d.com/ScriptReference/Transform.RotateAround.html
Just rotate cube around the edge point
Your answer
![](https://koobas.hobune.stream/wayback/20220612164731im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I get the player to go according to the shape of the ground? 0 Answers
RotateAround using physics 1 Answer
2D Raycast not working as intended 2 Answers
Why didnt my Collider works? 0 Answers