playMaker

Author Topic: Per-Second question  (Read 2452 times)

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Per-Second question
« on: April 10, 2013, 06:26:09 PM »
If I am using a Rotate action to rotate a gameObject, and only Per-Second is enabled, it's treated as a single function and the state will end after all Actions are completed.  If both Per-Second and Every Frame are enabled, the gameObject will rotate at the specified amount every second.

That makes sense to me.

Here's my confusion:
If I have a Rotate action rotating a gameObject with only Per-Second enabled, but I have a Send Event action with a 5 second delay, (or a Wait action configured similarly), the gameObject still only rotates once and then stops, despite the State being active for the full 5 seconds.

I can see this being intended behavior, because I still don't have "Every Frame" enabled in the Rotate Action itself, however doesn't that make it pointless to allow an Action to have only Per-Second enabled?  I would think there should be a dialog or notification that says "must have Every Frame enabled with Per-Second", or simply not display the Per-Second checkbox at all unless Every Frame is enabled already.

Additionally, if Per-Second only works with Every Frame enabled, doesn't that cause Per-Second to be frame-rate dependent anyway?



« Last Edit: April 10, 2013, 06:28:03 PM by artician »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Per-Second question
« Reply #1 on: April 11, 2013, 01:43:52 AM »
Hi,

 the confusion comes from the wording.

"everyFrame" in this case ( when you ticked "per seconds") ONLY means that the action will not finish, that's all there is to it.

if you look at the code, you'll see that if "everyframe" is not ticked, then it finishes the action during the onEnter(), else it will not and thus the OnUpdate() will be effective. then the "per seconds" checkbox kicks in, either it simply rotate every update ( frame rate dependant), or per second ( NOT frame rate dependant).

the second catch, is that no matter what, here we are using the Update call to rotate our object, BUT when it's per second, we compute exactly how much it should have rotate based on the deltatime between the last update and this update, that's how a true frame rate independant animation can be achieved.

Bye,

 Jean