This question was
closed Feb 13, 2020 at 08:22 PM by
ZachRoman121 for the following reason:
Other
Question by
ZachRoman121 · Jul 25, 2017 at 03:28 AM ·
rigidbody2dvelocitywallssticking
[Not solved] RigidBody2D sticks to walls
Hello!
All day i was trying to fix this problem with my player
When i jump and run into a wall. I am able to stay there until i let go of the key to move
I tried using physics materials. They work but i really can't use them because friction is important
I am moving my player by setting it's velocity
Any help would be appreciated!
Edit: Here's my function to move left and right:
void moveCharacter(string direction) {
if(canMove == true) {
switch (direction) {
case("Left"):
if (playerFacing == "Right") {
flipPlayer ();
playerFacing = "Left";
}
Vector2 moveVelL = playerRB.velocity;
moveVelL.x = -1 * speed;
playerRB.velocity = moveVelL;
break;
case("Right"):
if (playerFacing == "Left") {
flipPlayer ();
playerFacing = "Right";
}
Vector2 moveVelR = playerRB.velocity;
moveVelR.x = 1 * speed;
playerRB.velocity = moveVelR;
break;
}
}
}
Comment
Follow this Question
Related Questions
2D player slower on ground than in air 1 Answer
Unity Rigidbody2D bug 0 Answers
Player Sticking to walls 1 Answer
Collision detection for the next frame 1 Answer
rigidbody2D's velocity not working 1 Answer