So im trying to make my character kick off the wall after a wall jump but i am definatally having trouble implementing smoothdamp().
Originally I had
which works but its obviously this is not smooth which is why I need smoothdamp().
So I tried smoothdamp() about 1000 different ways and none seem to work.
Question: Do i use Mathf or vector3 smoothDamp(), also what to i do to make it work.
another note my set up is like this:
Could that be part of the problem since smooth damp is indirectly in the update function
please provide a bit more info as to how you are doing the character control, general jumping and detection of the wall...
typically... you will use a character controller of some sort when the character is grounded on the floor. and when you press jump.. launch the Y/up component in you character's movement, and change to a different controller while in the air, or de-activate the controller in place of a 'falling' controller, and add in gravity while the character is not grounded, so it falls.
For a wall jump.... when the character is not grounded, and you detect a collision with a vertical wall (a vertical wall will have a 0 Y component in it's polygon's normal)... ..and when a jump button press occurs at or near the same time.... Then you will take the normal vector of the wall,multiplied by your character's usual speed, as your player's new movement vector, except set the Y motion to your usual Y-up jump value. (or something of this sort), and again set the player in the falling state (not grounded)
you can also set your character's forward vector, to match the wall's normal vector, so it changes facing direction.
I have the wall jump working, but where im at is if i jump off the wall, he will shoot straight up and not out. This is bad because this way he can "climb the wall" like a ladder.
What I want to make him do is when he jumps he goes 3 to 5 units away from the wall on the x axis
answered Jun 27 '11 at 03:48 PM
when you collide with the wall, get the normal vector of the collision, it should point out from the wall, use this as the basis for the new direction your character will be moving in... newCharacterMovementVector = collisionNormal * character speed + Vector3.up * jumpUpSpeed
if you are using a unity box collider then the normals should be ok. But if you are using your own mesh, check to make sure the normal is pointing side-ways and not up