Walls Mysteriously Repelling Rigid Body Player Character
I'm running into a really strange scenario where having the player character jump while standing next to a wall exerts a strange repelling force away from the wall.
The behaviour is somewhat inconsistent, but seems to be influenced by:
how close the player is to the wall
the angle they are facing
(This seems the biggest factor) if the top of the wall is a different mesh than the bottom of the wall. This seems to "hiccup" something in the collider when it's transitioning between the two meshes. and pushes it away
The below screenshots demonstrate before starting the jump action, and the result after jumping. The character controller is based around a rigid body.
This is really confusing, as the material settings for the player character (while jumping) are set to:
0 friction
0 bounciness
minimal drag
friction combine set to minimum
bounce combine set to minimum
rigid body continuous, and interpolating
The only applied force is directly upwards, and there shoudln't be any direct forces being applied towards or away from the wall (code snippet below).
Any ideas what may be causing this?
The code to enter the jump state is as follows:
// enter jump state.
// reset jump power.
mc.jump_persist_energy = PlayerConstants.JUMP_PERSIST_ENERGY_MAX;
// add jumping force.
mc.rigid_body.velocity = new Vector3
(mc.rigid_body.velocity.x, 0, mc.rigid_body.velocity.z);
mc.rigid_body.AddForce(Vector3.up * PlayerConstants.FORCE_MULTIPLIER_CROUCH_JUMP, ForceMode.VelocityChange);
// player sound.
mc.audio_source.clip = mc.sfx_player_crouch_jump;
mc.audio_source.Play();
Your answer
Follow this Question
Related Questions
Rigidbody sticks to wall 0 Answers
Why my gravity direction is rotating with transform.rotation? 1 Answer
How to apply a force at certain point of an object? 0 Answers
[Help] Player stops moving when hitting wall diagonally 0 Answers
What about physics happening far from the (floating) origin ? 0 Answers