How to make a forward jump pad?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 99week

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.

:bust_in_silhouette: Reply From: lewis glasgow

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

Not working :confused:

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).

99week | 2021-08-15 16:22

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

lewis glasgow | 2021-08-16 09:33

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

99week | 2021-08-16 12:14