![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Macryc |
Hi All.
I have a bunch of area nodes placed at different distances from the player - I want to use them to measure the length of a throw of a rigid body by the player. Basically, the length would be measured by area nodes emitting signals to a ‘measurement’ function once the rigid body hits the ground in their area (ie, enters them).
I want to only build one function to collect the lengths and display them, therefore I am thinking of passing a length value from each area node into the display function’s length variable. Something like this:
Area node’s code:
extends Area
onready var thrownObject = get_node(“root/thrownObject")
func _ready():
connect("body_entered", thrownObject, “measure_length.length_variable = 1000”)
Display function’s code:
func measure_length():
var length_variable
if body.name == “thrownObject”
print(“Object landed on 1000”)
Or something along these lines. What would be the best method to achieve this?