x


Character move/ wall jump

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

controller.Move(Vector3(-2,0,0)); 

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:

function wall jump(){
    code
    smoothdamp()
}


function update{
    walljump()
}

Could that be part of the problem since smooth damp is indirectly in the update function

more ▼

asked Jun 26 '11 at 04:24 PM

jlimbach gravatar image

jlimbach
11 5 7 8

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Jun 26 '11 at 06:24 PM

JonnyHilly gravatar image

JonnyHilly
167 4 6 9

(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Jun 27 '11 at 03:48 PM

jlimbach gravatar image

jlimbach
11 5 7 8

(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Jun 27 '11 at 04:15 PM

JonnyHilly gravatar image

JonnyHilly
167 4 6 9

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x34
x5

asked: Jun 26 '11 at 04:24 PM

Seen: 1500 times

Last Updated: Jun 27 '11 at 04:16 PM