For Third person games with directional movement the code is : if Input.is_action_just_pressed("blink"): var forward_direction = -global_transform.basis.z var teleport_vector = forward_direction.normalized() * -teleport_distance var teleport_position = translation + teleport_vector var collision = move_and_collide(teleport_vector) if collision: teleport_position = collision.position translation = teleport_position This also checks collision so your players can't teleport through walls or fall through the terrain keep in mind that this version is adjusted to teleport your player where the camera is pointing not where the player is facing, if you use a different directional system just use your direction variable instead of "forward_direction" also change -teleport_distance by deleting the minus like this if Input.is_action_just_pressed("blink"): var teleport_vector = direction.normalized() * teleport_distance var teleport_position = translation + teleport_vector var collision = move_and_collide(teleport_vector) if collision: teleport_position = collision.position translation = teleport_position
Hey, if you were having a hard time with the blinking throwing you out of the map, I got a solution that worked for me, it doesn't use raycast(Sadly that didn't work with me.) So here's what I did: if Input.is_action_pressed("dash"): translate(Vector3(0, 0, -1)) if is_on_wall(): translate(Vector3(0, 0, 5)) Basically this means that whenever the character hits the wall, they stop moving and bounce back, like when you throw a ball to a wall. Worked for me, maybe it works for you.
instead of putting the if Input.is_action_pressed("ability"): translate(Vector3(0,0, -warp_dist)) inside of the movement bits just put it under _process, that way you dont have to past it as much and now you can do it while standing still
I find it more satisfying if you do: if Input.is_action_just_pressed("blink"): direction *= blink_dist seems a bit more natural ... thanks for the tutorial :D
I've tried to solve the collision issue with this addition: three more variables, gives the option to turn off the ability blink/pounce and the possibility to check if the player is walkin, falling, running state for the future export var player_can_pounce : bool = true export var player_pounce_speed = 50 var player_is_walking : bool at the beginning of _physics_process(delta): declared a new temporary variable and set it to 1 - so it won't change any multiplications var player_pounce_temp = 1 to every block of the WASD Input, I added: player_is_walking = true to get this: if Input.is_action_pressed("player_forward"): player_direction -= transform.basis.z player_is_walking = true print("player is walking - forward") after the WASD if Blocks, this: if Input.is_action_just_pressed("player_pounce") and player_can_pounce and player_is_walking: player_pounce_temp = player_pounce_speed and added the player_pounce_temp variable as a second factor to the linear interpolation: player_velocity = player_velocity.linear_interpolate( player_direction * player_speed * player_pounce_temp, player_accel * delta) after the mov_and_slide - set the player_is_walking status to false, if there has been no WASD key been pressed: if player_direction == Vector3(0, 0, 0):
player_is_walking = false #print("player walking - false") until now it seems to work quite well and collision does work due to the move_and_slide()
Great job with this series! Really escited to see the next video and wondering a few things, it's possible for a next video to the recall skill movement? and set it to be used with the same key after a few blinks? and another thinkg that im wondering, it's possible create a heightmap on godot using a mesh from blender? Keep the good work and good luck!
Hey garbaj, I really like your videos man I just have a problem When I write "fall.y = jump" (without the quotation marks) , godot just shows an error and I can't seem to know why Could you please help me fix this? Thanks man
"Orange leggings not included"
*sad cavalry noises*
For Third person games with directional movement the code is :
if Input.is_action_just_pressed("blink"):
var forward_direction = -global_transform.basis.z
var teleport_vector = forward_direction.normalized() * -teleport_distance
var teleport_position = translation + teleport_vector
var collision = move_and_collide(teleport_vector)
if collision:
teleport_position = collision.position
translation = teleport_position
This also checks collision so your players can't teleport through walls or fall through the terrain
keep in mind that this version is adjusted to teleport your player where the camera is pointing not where the player is facing, if you use a different directional system just use your direction variable instead of "forward_direction" also change -teleport_distance by deleting the minus like this
if Input.is_action_just_pressed("blink"):
var teleport_vector = direction.normalized() * teleport_distance
var teleport_position = translation + teleport_vector
var collision = move_and_collide(teleport_vector)
if collision:
teleport_position = collision.position
translation = teleport_position
TYSMMMM
Hey, if you were having a hard time with the blinking throwing you out of the map, I got a solution that worked for me, it doesn't use raycast(Sadly that didn't work with me.)
So here's what I did:
if Input.is_action_pressed("dash"):
translate(Vector3(0, 0, -1))
if is_on_wall():
translate(Vector3(0, 0, 5))
Basically this means that whenever the character hits the wall, they stop moving and bounce back, like when you throw a ball to a wall. Worked for me, maybe it works for you.
Speaking of Overwatch. Would you do a tutorial on Lucio-ish wall running?
Oof, that's a tough one. I would love to do a video if I can figure out how to do it
@@garbaj thanks man, keep doing what you're doing, you're videos are really helpful
Weird how you forgot the most important thing - adding a Raycast so that you cannot go inside of walls.
You don't need it.
instead of putting the
if Input.is_action_pressed("ability"):
translate(Vector3(0,0, -warp_dist))
inside of the movement bits just put it under _process, that way you dont have to past it as much and now you can do it while standing still
Nice but could you make a video about it with collision detection?
I find it more satisfying if you do:
if Input.is_action_just_pressed("blink"):
direction *= blink_dist
seems a bit more natural ...
thanks for the tutorial :D
I did this with his updated movement script, it works on the ground but not in the air, and I have no idea how to make it work airborne :(
this helped sm, ty!
I've tried to solve the collision issue with this addition:
three more variables, gives the option to turn off the ability blink/pounce and the possibility to check if the player is walkin, falling, running state for the future
export var player_can_pounce : bool = true
export var player_pounce_speed = 50
var player_is_walking : bool
at the beginning of _physics_process(delta): declared a new temporary variable and set it to 1 - so it won't change any multiplications
var player_pounce_temp = 1
to every block of the WASD Input, I added:
player_is_walking = true
to get this:
if Input.is_action_pressed("player_forward"):
player_direction -= transform.basis.z
player_is_walking = true
print("player is walking - forward")
after the WASD if Blocks, this:
if Input.is_action_just_pressed("player_pounce") and player_can_pounce and player_is_walking:
player_pounce_temp = player_pounce_speed
and added the player_pounce_temp variable as a second factor to the linear interpolation:
player_velocity = player_velocity.linear_interpolate( player_direction * player_speed * player_pounce_temp, player_accel * delta)
after the mov_and_slide - set the player_is_walking status to false, if there has been no WASD key been pressed:
if player_direction == Vector3(0, 0, 0):
player_is_walking = false
#print("player walking - false")
until now it seems to work quite well and collision does work due to the move_and_slide()
Nice, good to see that it works
Great job with this series! Really escited to see the next video and wondering a few things, it's possible for a next video to the recall skill movement? and set it to be used with the same key after a few blinks? and another thinkg that im wondering, it's possible create a heightmap on godot using a mesh from blender?
Keep the good work and good luck!
I have a few other videos coming out before I make another tracer video, but ill keep those ideas in mind
ua-cam.com/video/mLr8DtQ_Wbw/v-deo.html Recall
Really good video, super easy to follow along with, one question, is there any way to add a cool down to it?
I think it would be better with hyperspeed to a point, because of collison detection.
Good point, I didn't even think about that
Hey garbaj, I really like your videos man
I just have a problem
When I write "fall.y = jump" (without the quotation marks) , godot just shows an error and I can't seem to know why
Could you please help me fix this?
Thanks man
How can you make it smooth
Please make a video on a Spiderman character controller. I am talking about the grappling hook part.
There's been a lot of requests for grappling hooks. I'll put it on the list
Niceeee
nice
when I blink in front of a wall I can go trough it can u help me pls
uuhuhhh kinda late but on a characterbody you can call move_and_collide with your movement vector
instead of changing position
what if I dont want it to blink but more so woosh to it? like a dodge?
Orange leggings not included😂😂😂
Awesome. Now do the recall. 🤣🤣
how can i use this on the updated fps movement?
what about dishonored style blink?