I want to create a raycast that has a maximum of 5m length, then I want it to be 'shortened' so that the raycast's (normally 5m) length can be shortened to a maximum of 5 and a minimum of 0. Preferrably I want it to be able to grow back after the collider is no longer shortening it. After all of this, I want to get its current and/or shortened length (max 5, min 0).

Using global_transform_origin and get_collision_point both return Vector3 values that seem to be in global space, whereas I just want a float.

How can I accomplish this?

  • xyz replied to this.

    altevc Subtract the collision point from origin and take the length of the resulting vector.