- Home /
My character moves in seemingly random directions.
I'm trying to build a game where you can grab any platform under you at any inclination. While the player is grabbing the platform, they should be able to move parallel to their inclination.
rb2d.transform.position = rb2d.transform.position + new Vector3(moveHorizontal * Mathf.Cos(rb2d.rotation), -moveHorizontal * Mathf.Sin(rb2d.rotation));
However, my character seems to be moving in seemingly random directions on any surface that isn't horizontal. What error did I make?
Thanks for the attention.
EDIT: Also, is there a way to implement more strictly the game's collision detection? My character phases through rigidbodies.
Answer by GiacomInox · Dec 22, 2017 at 04:35 PM
Neverming, I solved it. I just had to multiply rb2d.rotation by Mathf.Deg2Rad, converting degrees to radians.
Your answer
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
2D Slope acceleration 1 Answer
Modifying physics in 2D 0 Answers
Need to restrict "air control" 2D platformer. 1 Answer
Should 2.5D use 3D or 2D settings ? 3 Answers