0 votes

I'm making a jump pad, which the player walks on and it gets thrown up and forward in the air (similar to Apex Legends). I managed to make it jump up by velocity.y = 10 but couldn't figure it out how to throw the player in a specific direction. Currently this system works with an Area (3D) node, when the player touches it.

Godot version v3.3.2
in Engine by (44 points)

1 Answer

0 votes
Best answer

when player touches jump pad do
player.velocity = transform.basis.z.normalized()*speed

by (262 points)
selected by

Not working :/

The code:

    if area.is_in_group("jump_pad"):
        velocity.y = 30
        velocity = transform.basis.z.normalized()*speed

velocity = transform.basis.z.normalized()*speed eliminates velocity.y = 30 and nothing happens. Also the script is in the player.gd because the players Area (3D) activates the code (area_entered).

so that velocity is not cancelled out switch
velocity.y = 30 and velocity = transform.basis.z.normalized()*speed
and velocity -= transform.basis.z.normalized()*speed
other than that i dont know what the problem is. if you want to send the project and i can try and find the problem but sorry i cant help you

I played around with my code and changed velocity with currentvelocity and that worked. I totally forgot I was using currentvelocity. Thanks!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.