playMaker

Author Topic: Rotating hundreds of objects?  (Read 1637 times)

Groo Gadgets

  • Beta Group
  • Full Member
  • *
  • Posts: 175
Rotating hundreds of objects?
« on: April 19, 2016, 09:04:49 PM »
Hey guys,

My game has hundreds of instanced coins in my scene and they all need to rotate on the Y axis. Currently I have a simple FSM on each of them but for the sake of performance does anyone know of a way that I can rotate them all from a single master FSM?

I have done a Google search and found a C# solution (sort of) that uses the objects tag:
http://answers.unity3d.com/questions/552766/rotation-with-multiple-objects.html

Anyone know of a simple Playmaker solution?

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotating hundreds of objects?
« Reply #1 on: April 20, 2016, 02:21:40 AM »
Hi,

 That's no ideal.

Few tips:


-- You don't have 100's of coins framed with the camera, so optimize here and only animate coins that are visible to the camera. that's true for everything in big levels

--  user a proper tweening engine like dotween, don't use custom code for such thing.

-- use a Unity animation curve so that you don't even need any scripts at all to begin with... that's likely the most effective way.

You can have one fsm iterating through all coins and rotating them, that's possible yes, use "Iterate" action from the Ecosystem and to find all coins, you can either maintain a list using ArrayMaker or if you have PlayMaker 1.8 use an FsmArray. Everytime you create and delete a coin, simply add or remove that entry in the Array.


Bye,

 Jean
 

Groo Gadgets

  • Beta Group
  • Full Member
  • *
  • Posts: 175
Re: Rotating hundreds of objects?
« Reply #2 on: April 20, 2016, 07:12:09 AM »
Use a Unity animation curve! Duh! My brain wasn't working when I asked that question!

Thanks for the quick reply Jean, very much appreciated  :-)

Simon