Forum rules - please read before posting.

Toggle on/off camera component

Hi,

Is it possible to turn on and off specific camera components through AC? I have a bloom filter on the MainCamera and want to turn it off when switching to a particular GameCamera, then have it turn back on when going to another. Would this require a custom script?

Thanks,
Jason

Comments

  • It would - a custom Action would be best, as you can then trigger it as part of a larger ActionList.

    AC's MainCamera component can be accessed with:

    AC.KickStarter.mainCamera;
  • Thanks for the reply, Chris. I'm new to writing scripts so I'm a little lost here. I took a look at the custom Action link you posted and went through the "Change gravity" example, but am still struggling to figure out where to go from there.

    Where do I put AC.KickStarter.mainCamera; in the ActionTemplate? 

    Any help you could give would be appreciated.

    Thanks,
    Jason
  • It'll go in the Run() function - this is what gets called when the Action is actually triggered.

    But the code I posted was just the API reference to the MainCamera - not the complete code you'd actually run.  This isn't a coding forum, but to disable a component named e.g. "BloomFilter", you'd want to run:
    AC.KickStarter.mainCamera.GetComponent ().enabled = false;
    (Or "true", if you want to enable it.)
  • Thanks, Chris! Will try that out.

    -Jason
  • If you find you're struggling you could always use zone controller. Should have no problem running with AC.
  • Deckard_89, that plugin is amazing! Looks perfect for what I need. Thanks!
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.