Forum rules - please read before posting.

Auto detect hotspot

Hello to all!


I want to have one of my hotspots being activated as a trigger (when the player steps on it, it activates). I have read here that for that I can use the player viticinity option in the settings menu, but the thing is I want this for only a couple of hotspots, not for all.


The scenario I want to manage is as it follows: I have a 2d scene with two ground levels (one higher than the other). The higher ground covers part of the lower ground. It is similar to the following drawing (done in paint, don't judge me):

image

So I want that, when my player walks from the higher to the lower ground (red line), a hotspot activates on the border, and a animation in which my player is shown to be "going down" plays (and at that moment, I switch to the navmesh of the lower ground and he can move all ok until he clicks towards the higher groung again).

Right now, if I click on the lower ground, my player just steps over as if it was a continuation of the higher ground, and it looks really bad (floaty).



So i have a couple of questions:

1- Is it possible already to do this? (choose detection method hotspot by hotspot instead of setting's wide), and if so, how?

2- If it is not possible, could it be added as a feature? (like, in the inspector for each hotspot, choosing the method of detection)-

3- If it is not possible in the easy way, then I guess I'd have to do it via scripting. Are custom events a good way to do this?

4- Let's say I manage to make the animation of the player going down the slope play. I still want the player to keep walking, once in the new navmesh, towards the point he clicked in the first place. Is that possible?


Thanks in advance!

Comments

  • edited June 2017
    I'm a bit confused by the question because I don't see where hotspot detection comes into this. However, if I understand what you want to do correctly, I can think of two ways you might do it:

    1. Put a trigger at the edge that causes a cutscene to play to get the character from one level to the other. Make sure the trigger interrupts walking. When the character hits the trigger, they'll stop heading to the navmesh point and instead play the cutscene and end up on the other level.

    2. You could actually use hotspots for the other level the character is not on. So you have two hotspots, one corresponding to each location, and two navmeshes, one corresponding to each location. When the character is on the high part, the navmesh for the low part would be disabled and the hotspot for the low part would be enabled, and vice versa. The hotspots would run a cutscene to make the transition, disabling and enabling navmeshes and hotspots accordingly.
  • Triggers have a Cancels interactions? option.  When checked, and a Player passes through it "on their way" to a Hotspot (i.e. to run an interaction with Player action set to Walk to Marker) then the Trigger will cancel this interaction and run itself instead.  The Hotspot itself can have a blank interaction - this trick allows you to direct the Player to a certan point on the screen when they click, and have a Trigger run instead.

    This trick can be used for both ways: moving foreground -> background and vice versa.  Two Triggers and two Hotspots - using Object: Send message and Hotspot: Enable or disable Actions to turn the two sets on and off as needed.  An additional local boolean Variable could also be used to keep track of which area the player is in, should you need that information elsewhere.

    Something very similar is actually covered at this point in the 2.5D tutorial.

    As for changing the scale / sorting order of the player when in the background, you can create an additional Sorting Map and use the Character: Change rendering Action to lock him to it.  The Scene: Change setting Action can also be used to change the active NavMesh.

    As for making the player move to the correct spot afterwards, you'll have to rely on a little custom scripting to record the position.

    Since the user will in fact be clicking on an invisible (presumably nameless) Hotspot, the player will actually moving towards that Hotspot's Walk-to Marker (before being interrupted by the Trigger).  Therefore, you'll need to record the position in the scene that is actually clicked on, so that you can later have the player move there.

    Custom events can indeed help you here: the OnHotspotInteract event is called whenever the user clicks on a Hotspot.  You can write a custom event that checks to see if is the "move to background" Hotspot, and record the mouse position in the scene at this moment.  A custom Action could then move the player to this point at the end of the Trigger:

    AC.KickStarter.player.MoveToPoint (myClickPoint, false, true);

  • Yeah, my mistake haha. I had totally missed the trigger prefab and so thought that the detection had to be done via hotspot in AC.



    Wow thanks a lot for the explanation! I'll do that since it seems to fix my issue completely =D 
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.