Question by
unity_6ZMJlhFpaWH3QA · Jul 02, 2019 at 03:06 PM ·
jumpplatformerfauxgravity
faux gravity 2d plataformer jumping doesnt work
the player flyes if he's walking and jumping at the same time
void Run(float directionOnX)
{
Vector2 horizontal = new Vector2(directionOnX, 0).normalized;
rb.MovePosition(rb.transform.position + rb.transform.TransformDirection((horizontal) * MoveSpeed * Time.deltaTime));
}
void Jump()
{
Vector2 vertical = new Vector2(rb.velocity.x, JumpSpeed).normalized;
rb.velocity = rb.transform.position + rb.transform.TransformDirection((vertical) * MoveSpeed * Time.deltaTime);
rb.velocity = rb.transform.position + rb.transform.TransformDirection((-vertical) * MoveSpeed * Time.deltaTime);
Comment
Your answer
Follow this Question
Related Questions
Unity2D Player Jump Heights Inconsistent,Unity2D Inconsistent Player Jump Heights 0 Answers
Jumping on enemies help 0 Answers
Player does not jump again after first jump. 0 Answers
Ground check doesnt work 0 Answers
How to change physics properly? 0 Answers