playMaker

Author Topic: Applying color to all light in array at ones.  (Read 2108 times)

ttham

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Applying color to all light in array at ones.
« on: February 03, 2017, 11:10:05 PM »
Hi.I have array of lights I need to apply one color to all of them with "Color interpolate"  but if i'm using "Array get next" action, its working one by one,how to do it simultaneously? Tank you!
« Last Edit: February 04, 2017, 05:20:18 AM by ttham »

ttham

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Applying color to all light in array at ones.
« Reply #1 on: February 04, 2017, 08:49:25 AM »
I guess i need something like "foreach" but i can't find any action like that.

Dreatern

  • Playmaker Newbie
  • *
  • Posts: 21
    • View Profile
Re: Applying color to all light in array at ones.
« Reply #2 on: February 04, 2017, 02:19:07 PM »
What about use a FSM template with everything you need and use the template on each light.
That way i believe you can change the "main" template and every light will react to that at the same time.  I think templates are instances but I do not know the behavior at runtime


« Last Edit: February 04, 2017, 02:20:57 PM by Dreatern »

ttham

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Applying color to all light in array at ones.
« Reply #3 on: February 04, 2017, 07:12:50 PM »
Yea i saw that action, but a was afraid that this is gonna be bad for performance.
But if there is no other way i have no choiсe. Thank you.

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
    • View Profile
Re: Applying color to all light in array at ones.
« Reply #4 on: February 05, 2017, 10:08:03 AM »
You can use the array get next to perform actions for each object in array. Templates can work like methods. You can pass data to it and perform actions involving that data and then return events with data. So you can pass a light game object to a template then perform actions on it and then send event or just finish fsm.
« Last Edit: February 05, 2017, 10:18:35 AM by elusiven »

ttham

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Applying color to all light in array at ones.
« Reply #5 on: February 05, 2017, 08:54:32 PM »
Ok I'm trying this http://prntscr.com/e50atk
This what i have on a light object.http://prntscr.com/e50b31
"Light" is global variable.and it's not working.
If i set it on self its just change color on game start.
I can use global transition of variables to activate template, but it will affect all lights in scene not only those that i picked in current array.


ttham

  • Playmaker Newbie
  • *
  • Posts: 14
    • View Profile
Re: Applying color to all light in array at ones.
« Reply #6 on: February 07, 2017, 12:30:10 AM »
Ok its working now, but it still goes one by one. Even with that for each action.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15459
  • Official Playmaker Support
    • View Profile
Re: Applying color to all light in array at ones.
« Reply #7 on: February 07, 2017, 12:52:21 AM »
Hi,

 Don't worry with iterations and loop in this sort of features, it's fine. Be aware that even if a custom action was made, it would still need to iterate trhough that list anyway, so actually makes no difference, the slight overhead of doing it manually is totally insignificant compared to what could go wrong with shaders, visual effects, meshs in your scene that would affect frame rate and performances way more.

 Bye,

 Jean