I have a Rigidbody attached to my character and I tried to use Physics.velocity or Physics.addforce to jump but when I was running against a wall I couldn’t jump anymore only when I let go of the moving joystick. I guess it is because I’am adding force up aswel as forward so he wil ‘scrub’ the wall causing himself not to jump…? Is there a way to solve this besides using a CharacterController? Thanks in advance. btw I also tried “rig.AddForce(transform.up * jumpHeight, ForceMode.Impulse);”
Make sure your character’s collider is NOT a box, should be either sphere or capsule. Box has sharp corners that eventually “stick” into that wall, thinking it’s a ceiling
Can you share your code please, and maybe a screenshot of your scene ?
I guess your character collides with the wall, so the base physics engine reduces the force applied to your char.
void Start()
{
playerRig = GetComponent();
anim = GetComponent();
}
private void FixedUpdate()
{
h = Joystick.Horizontal;
v = Joystick.Vertical;
Move(h, v);
}
private void Move(float h, float v)
{
movement.Set(h, 0f, v);
if (movement != Vector3.zero)
{
Quaternion newRotation = Quaternion.LookRotation(movement);
playerRig.MoveRotation(newRotation);
}
movement = movement * speed * Time.deltaTime;
playerRig.MovePosition(transform.position + movement);
public void Jumping()
{
if (IsGrounded)
{
rig.AddForce(transform.up * jumpHeight, ForceMode.Impulse);
}
If I use Transform.translate for jumping, it wil still go up when running against a wall but it will not go with physics so it looks silly. Anyone has an idea? @Vollmondum