All Questions

Community

M
marko95
posted to: Aiming the Hook

RayCast2d in Hook scene

Hello :)

Are you sure that you need RayCast2d in Hook scene ?

All work is done by SnapDetector.

Also I printed owner.ray_cast.cast_to.length() in Aim.gd, value is always between 461 and 459

  • Nathan Lovato replied

    Yes, sure, it's used to prevent the player from hooking onto a target when there's a thin obstacle between the player and the hooking point.

  • M
    marko95 replied

    In script of SnapDetector exists code to prevent that.

    func find_best_target() -> HookTarget:

    ...

    # Skip the target if there is a collider in the way

    ray_cast.global_position = global_position

    ray_cast.cast_to = t.global_position - global_position

    if ray_cast.is_colliding():  <------------- here

    continue

            ...

    return closest_target



     RayCast2d in Hook scene is used only in Aim.dg script.

  • Nathan Lovato replied

    Ah I see. The one in the Hook scene has a different purpose: it gives you support for hooking onto surfaces instead of HookingPoint instances, like a wooden wall or a special ceiling.

    Not sure I got to integrate it into the tutorial's demo, unfortunately, I ran out of budget for this project (the course didn't sell at all initially).

  • M
    marko95 replied

    Aha, I get it :D

    I am so sorry to hear that :/ The course is great. I learned a lot.

  • M
    marko95 replied

    Have you thought about making some mobile game tutorial?

    There aren't to many tutorials in which they make mobile games. I found just one, with 5 videos.
  • Nathan Lovato replied

    Sure, I thought about it. Got other plans for now.