[SOLVED] Wall Jumping Bug

You have to use teleport or apply torque on the rigidbody.

This is generally why in the FPS tutorial we don’t rotate the player entity, just the camera. Given that the player is a capsule, it doesn’t need to be rotated

Oh, how would I apply the right torque then? Either that or uh, how would I properly apply the impulse away from a wall? Like, I have the two detectors that test if there is a wall next to the camera, so how would I set it to propel away from the detected wall?

Is there maybe a way I can teleport without losing my momentum and not having jittery movement?

You could have a child entity under the rigidbody that represent’s the player’s orientation instead. Then you don’t have to worry about the rigidbody at all

I’m sorry but could you elaborate on what you mean?

Also, if I use applyImpulse() and set the second argument, would it push you away from that point? That’s how I do jumping. I still have the two points on the sides of the camera that you would be pushed from.

@yaustar question, would lookAt() only turn the entity or would it also turn the rigidbody? I’m trying to figure out some solution to make the player boost in the correct way. I’m not understanding the “relative point” part of the impulse method, as I had set the relative point to be the side of the rigidbody, but it doesn’t move away from it or anything.

Only the entity.

You are rotating the rigidbody for a reason. I don’t know what the reason is but assuming it’s to help with some direction calculations, you can create an entity as a child, apply the rotation to that and then do the direction calculations on the child.

So the reason why I wanted to rotate the rigidbody was so that I could have the impulse applied in the right spot. Basically I apply (-1000,2000,0) to walljump to the left, and (1000,2000,0) to walljump to the right. But when I turn my camera, the points that it raycasts to move with the camera, so if I look behind me and try to walljump to the left, it applies the right impulse, but my rigidbody is not facing the correct way, so it boosts me into the wall instead of away from it.

EDIT: If needed I can record a video.

Applying impulse is done in world space. It’s not relative to the direction the rigidbody it’s applied

Oh, well then how can I make them jump in the right direction? Could I just put the position of where the wall touches into the impulse spot and it would jump away?

For example: Applying (10, 0, 0) will always push to world right no matter the orientation of the rigidbody.

What you want to do is define the direction you want the impulse to be applied to.

The way I would do it is when the player makes contact with the wall, take the collision normal and use that as the direction to apply the impulse in for the wall jump. Or use it as the base of your calculation.

I don’t understand how I would do that, how would I define the direction?

Sorry, I’m afraid you will have to wait for someone else to help for this. I don’t really have the bandwidth to go deep into this unfortunately

Alright, thanks!

So I went into a new project and used an apply impulse with a relative position, which would be local. My impulse was (0,10,0) and my relative position was (1,-1,0), and when I executed it the cube flew away from the relative position, but for some reason that doesn’t work with my capsule?

edit: it needs rotational force to do that.

After doing a ton of math, I have officially made a 360 angle wall jump mechanic. This can be marked as solved.

can you pass it please?

@EXECUTABLE Sorry for the late response, but yeah, it’s in my project Distorted Forces, feel free to poke around in there.