Hello people! I hope you’re doing great! Dave here with an amazing issue! Thi is the point, I am trying to develop my game in unity again, the context:
I created the player gameObject and attached a rigidbody 2D as well and attached a script for jumping move and those stuffes. Well, i need to validate that my player is on the ground but i need rigidbody 2D linear Velocity Y to validate that i am just falling or stoped by physics (gravity basic functionality) well, the grounded bool var works fine if I move my player to the right, but when i move to the left, grounded is false because:
LinearVelocityY is getting a positive random value if linearVelocityX is negative.
Why is this happening if
rb.linearVelocityX = moveDirection.x * horizontalSpeed;
???
rb.linearVelocityY+= gravitySpeed is constantly been reduced in fixedUpdate to ensure that player is falling, but if I read rb.linearVelocityY, this values becomes weird by changing just X coordinate in velocity property!
Do you know why is this happening???