- Home /
I need HELP ! Wall Jump in 3D Platformer CharacterController
I am working on a 3D platformer and I want to be able to wall jump, I can control my character while my player is in air, but I need wall jump using CharacterController.
Here is the movement code that I am using to move, jump and control my player while he is jumping:
// Movement fields
float speed = 6f;
float jumpSpeed = 12f;
float gravity = 20f;
Vector3 moveDir;
void Update ()
{
Movement ();
}
void Movement ()
{
if (controller.isGrounded) {
moveDir = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
moveDir = trans.TransformDirection (moveDir);
moveDir *= speed;
if (Input.GetButton ("Jump"))
moveDir.y = jumpSpeed;
} else {
moveDir.x = Input.GetAxis ("Horizontal") * speed;
moveDir.z = Input.GetAxis ("Vertical") * speed;
}
moveDir.y -= gravity * Time.deltaTime;
controller.Move (moveDir * Time.deltaTime);
}
@$$anonymous$$dRWaylander I have tried checking if the player Is in air and It is hitting a wall tagged "wall" then jump, but that's not working.
You haven’t presented a specific problem here, merely expressing a desire for a new feature. It’s best if the questions you ask have answers that are universally helpful—not soliciting a specific implementation of a feature for your codebase.
That said, I can point you to Sebastian Lague who has a great series on Creating a 2D Platformer controller using raycasts. It could be worth watching for some ideas, since he implements wall sliding and 3 different types of wall jumps.
Good luck mate!