Forum rules - please read before posting.

Checking which hotspot triggered

Hi all, I'd just firstly like to say to Chris that this asset is fantastic!

Onto my noob question. I have a situation where I have several different hotspot interactions that all lead to the same cutscene. The cutscene in question leads to the camera switching to a new camera that is transformed to the position of the hotspot that was clicked.

I've managed to achieve this with a simple script that moves the new camera to wherever the mouse clicks via raycasting, the camera only then switches to this camera when the hotspots are clicked by running the aforementioned cutscene. This has been working extremely well however sometimes for some weird reason the mouse click will register the hotspot (so activate the cutscene to switch cameras) however the new camera doesn't seem to move to the new raycast position of the mouse.

There might be things I need to mess about with with the custom script because for the hotspot to be clicked then obviously the mouse is raycasting to the hotspot so not sure why the new camera isn't moving to this new position all the time! My alternative option was to see whether the cutscene could chek which of the several hotspots triggered the cutscene and then simply Object:Transform the new camera to the point of the hotspot. I could of course create a separate cutscene for each and every hotspot and manually set each hotspots cutscene to move the cam to that particular hotspot (so instead of hotspot01, 02, 03 etc all leading to cutscene01 I would instead have hotspot01->cutscene01, hotspot02->cutscene02, hotspot03->cutscene03 etc) however when I say I have several hotspots I mean I have 30+ and it will be a common thing through different scenes so really do not fancy going down this tedious route at all.

So essentially is there a way for me in my current cutscene01 to check which hotspot triggered it and then move the new cam to the position of that triggered hotspot? Having looked through the action list options I doubt there is a built in option for this however even if someone can advise of any custom scripting they can think for this it would be greatly appreciated.

Hopefully my ramblings make sense. Once again thanks again to Chris, you my sir are a legend!

Mike.

Comments

  • Hello Mike, thanks - and welcome to the community.

    While I can't speak for the custom script you wrote, it sounds like parameters will be the way to go here.  ActionList parameters are essentially like function parameters, in that they let you change the values of pre-defined Action fields each time an ActionList is run.

    You could use them to change where the Camera is transformed (or which Camera itself is switched to, as is the standard AC way of working with cameras) by running the same Cutscene each time.

    A tutorial on parameters can be found here.
  • Chris, thanks for the response. I've used this forum for a few weeks now and notice that you are extremely active and prompt with responses which is just as useful as the asset itself, it is very much appreciated!

    Parameters are a great tool and something I've previously missed which I will definitely be utilising in the future however in my instance it isn't exactly what I'm after. Using the parameters I'd still have to manually go into each hotspot to run a specific action list to run the main action list to assign the specific parameters. For me I could do with an Acton list with parameters, as you mentioned, but with the action being Object:Teleport to 'Parameter Hotspot', then the parameter is populated not by a separate action list running it but by it being populated by the hotspot that was triggered.

    At the moment my issue is game breaking and I will have to sort it out at some point so doing it the long and tedious way is something I might just have to do but it would be great if not. Hopefully makes sense.
  • I admit, it is a little complicated to understand.

    But of course you can always revert to a custom Action, which may be an option as you're already writing your own custom script to detect Hotspots.  For a completely custom-tailored solution, I'd recommend using your custom script to detect the last-clicked Hotspot, and then passing it to a custom Action that moves the camera towards it.

    You'd probably only want to detect clicked Hotspots during gameplay (so that clicks during i.e. Cutscenes are ignored).  You can do that with:

    if (AC.KickStarter.stateHandler.gameState == GameState.Normal)
    {
      // OK to detect Hotspots
    }
  • Thanks Chris, I'll definitely look into that as an option. Can't belive I'm having this much fun making a game! An actual functioning game too thanks to this brilliant asset, in fact the asset is so good it actually feels like I'm directing a film rather than making a game if that makes any sense. All I do is position characters, tell them what I want then to do and I'm away, no need to worry about any complicated scripting etc.

    Thanks again mate.
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.