playMaker

Author Topic: deltaTime during translation  (Read 8644 times)

ryf9059

  • Full Member
  • ***
  • Posts: 100
deltaTime during translation
« on: June 06, 2013, 03:41:41 AM »
Just wonder, with the help of state machine, is it still necesary to include deltaTime factor during mathmatical calculation to ensure stable and smooth framerate?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: deltaTime during translation
« Reply #1 on: June 06, 2013, 05:21:06 AM »
Hi,

 It depends the action really, some have it built in, some don't.

for example, some actions have "Per seconds" option which is what you want,

It's very rare when I need to manually multiply a fsm variable with delta time to achieve something, so in doubt, simply ask here, or check the code of the action you want to use to see what's actually going on ( right click on the action and click "edit script")


bye,

 Jean

ryf9059

  • Full Member
  • ***
  • Posts: 100
Re: deltaTime during translation
« Reply #2 on: June 06, 2013, 06:52:39 AM »
It depends the action really, some have it built in, some don't.

for example, some actions have "Per seconds" option which is what you want,

It's very rare when I need to manually multiply a fsm variable with delta time to achieve something, so in doubt, simply ask here, or check the code of the action you want to use to see what's actually going on ( right click on the action and click "edit script")

I use it for moving the player by getting axis vector.
But when I choose per second the player will not move at all.
I choose per frame and it works normally.

Also, I thought the fix update is for the delta time thing. After your explanation this confuses me

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: deltaTime during translation
« Reply #3 on: June 07, 2013, 12:59:21 AM »
Hi,

what action are you using?
 
The delta time is for any types of updates: Update,LateUpdate,FixedUpdate.

http://docs.unity3d.com/Documentation/ScriptReference/Time-deltaTime.html

http://answers.unity3d.com/questions/296336/timedeltatime.html

bye,

Jean

ryf9059

  • Full Member
  • ***
  • Posts: 100
Re: deltaTime during translation
« Reply #4 on: June 07, 2013, 03:26:37 AM »
what action are you using?

Translate with the followig enabled. I'm getting movement by using get axis vector

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: deltaTime during translation
« Reply #5 on: June 07, 2013, 05:06:56 AM »
Hi,

 Simply check "per seconds" and it will all start to work  (provided your factor is greater than 1)

bye,

 Jean

ryf9059

  • Full Member
  • ***
  • Posts: 100
Re: deltaTime during translation
« Reply #6 on: June 07, 2013, 06:46:47 AM »
Simply check "per seconds" and it will all start to work  (provided your factor is greater than 1)


Just one last question, the per seoncd option seemed to work in a quite similar way as fixed update (over one second interval). What's the differences between these two? Can these two be used together? Since my player moves at certain speed even if the framerate drops I still want it to move some distance after certain time has passed which is independent from framerate and that makes me think of using fixed update.

Thanks
« Last Edit: June 07, 2013, 06:50:10 AM by ryf9059 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: deltaTime during translation
« Reply #7 on: June 07, 2013, 07:01:48 AM »
Hi,

 This is a misleading naming. Anything XXXUpdate is unreliable in terms of timing, FixedUpdate is used for physics based work, but still you should use deltatime inside to make sure your movement are frame rate independant.

so you need to check "per seconds" even if you use "fixed update".

bye,

 Jean

ryf9059

  • Full Member
  • ***
  • Posts: 100
Re: deltaTime during translation
« Reply #8 on: June 08, 2013, 12:11:57 AM »
This is a misleading naming. Anything XXXUpdate is unreliable in terms of timing, FixedUpdate is used for physics based work, but still you should use deltatime inside to make sure your movement are frame rate independant.

so you need to check "per seconds" even if you use "fixed update".

How do I get deltatime in FSM? Which action is it?

doppelmonster

  • Full Member
  • ***
  • Posts: 157
    • Grinder Games
Re: deltaTime during translation
« Reply #9 on: June 08, 2013, 05:48:25 AM »
As far as i know there is no delta time action.
Delta Time is a feature wich is implemented in some actions (e.g. per second in translate)

You can manually build an event with a few actions wich act like delta time. Jean described it in your other thread.

I just had the similar question, check out the unitypackage Jean provided in this thread:
http://hutonggames.com/playmakerforum/index.php?topic=3947.msg18498#msg18498



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: deltaTime during translation
« Reply #10 on: June 10, 2013, 01:12:56 AM »
Hi,

 there is an action to get the delta time actually: "Get Time Info". In there you can selected different time properties, one of which is DeltaTime.

https://hutonggames.fogbugz.com/default.asp?W496

Bye,

 Jean

BryanPope

  • Playmaker Newbie
  • *
  • Posts: 3
Re: deltaTime during translation
« Reply #11 on: July 02, 2013, 02:09:25 PM »
If you right click on Translate then Edit Script, you will find out that having the "Per Second" option checked causes it to multiply the translate by Time.deltaTime.

If you are not getting any movement, are you multiplying the axis by some sort of speed variable?  (Get Axis -> Multiplier)

Cheers,

Bryan