#Help with deleting items that touches the ground.

1 messages · Page 1 of 1 (latest)

swift basin
#

Hello! Recently i've been learning Godot and after a bit of tutorials i've decided to give up on them and start to recreating some mechanics on the games i play, so, for starters i tried to make the echoes system from The legend of zelda: Echos of Wisdom.

It kinda works properly, but now i'm facing two problems:
1 - I wanted to if the echoe has affected_by_gravity variable enabled, i wanted for it to be deleted after falling from a certain distance, i tried making it RigidBody3d, Tried using is_on_floor but nothing seems to work properly and i'd like your help on it.
2 - I also wanted to rotate the echoe using the player's pivot, but it just works in the other way.

Here's a bit of gameplay: https://streamable.com/xfn5v1
Here's a bit of the EchoComponent Code (I removed the parts that didn't work, which ways the entirety of the phys_process)

class_name EchoComponent
extends RigidBody3D

@export var is_learnable := true
@export var is_pushable := false
@export var destroy_on_fall := true
@export var cost_to_spawn := 1
@export var affected_by_gravity := true

func _ready() -> void:
    if !affected_by_gravity: self.gravity_scale = 0

Watch "Echoes of Wisdom Prototype" on Streamable.

▶ Play video
#

I was planning on using a Raycast to check if its colliding with something then calculate the distance traveled to check if it should be destroyed or no, but i think that might not be the most efficient way to do this?

olive gorge
#

the two most common ways to handle this are probably either:

  1. check the velocity of the object and if it is exceeding a specific amount at the time of touching the ground, destroy it
  2. capture the vertical position of the object and compare it to the new vertical position on landing, again if it exceeds a certain threshold destroy it
#

shouldn't be too difficult to implement with what you've already got set up there