playMaker

Author Topic: Fixed time step  (Read 2961 times)

Hugo111

  • Playmaker Newbie
  • *
  • Posts: 45
    • UFENCEVR
Fixed time step
« on: July 25, 2017, 10:19:30 AM »
Hi all, is there a  FSM to change a fixed timestep  at the load of a level, as I have particular heavy physics needs in one level only, which I don't want to effect the rest of my game! Any ideas would be useful, thanks .

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Fixed time step
« Reply #1 on: July 25, 2017, 11:52:20 AM »
Hi,
I think you mean a Action instead of FSM :)

I made a 'Set Fixed Time Step' Action for you. (in the attachment below)

I tested it a bit and it seems to work.
Can you let me know if it works so i can add this to the Ecosystem :)


Hugo111

  • Playmaker Newbie
  • *
  • Posts: 45
    • UFENCEVR
Re: Fixed time step
« Reply #2 on: July 29, 2017, 09:16:29 AM »
Thank you soooo much that works brilliantly !!! Problem solved !!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Fixed time step
« Reply #3 on: July 29, 2017, 03:58:56 PM »
Ok! Thats 10 dollar!!

Joke!! i am happy to help  8) 8) 8)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Fixed time step
« Reply #4 on: July 31, 2017, 02:58:07 AM »
Hi

 Kurt, can you put this on the Ecosystem? thanks :)

 Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Fixed time step
« Reply #5 on: July 31, 2017, 03:21:54 AM »
Hi jean.

Done! :)

Ofonna

  • Full Member
  • ***
  • Posts: 230
Re: Fixed time step
« Reply #6 on: July 31, 2017, 03:29:49 PM »
hi hugo please what's the purpose of this fixed time step, i'd like to know how it can also help me,

thanks

Hugo111

  • Playmaker Newbie
  • *
  • Posts: 45
    • UFENCEVR
Re: Fixed time step
« Reply #7 on: August 11, 2017, 06:28:42 AM »
The purpose of the time step is to speed up in my case is  the number of time the physics engine sees collisions, so better for very fast collisions . But you pay a price on cpu performance !!   

Kubold

  • Full Member
  • ***
  • Posts: 112
Re: Fixed time step
« Reply #8 on: September 05, 2020, 05:12:37 AM »
Hey, this action still works good, BUT.

Can anyone make "Set Maximum Allowed Timestep" Action? Or modify the Set Fixed Timestep Action to also set the Maximum Allowed Timestep.

The Action "Scale Time" resets the Maximum Allowed Timestep to value: 0,2. This makes my game jitter after I turn on slomo. I need a Set Maximum Allowed Timestep Action to set it back to my preferred value.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Fixed time step
« Reply #9 on: September 05, 2020, 09:54:25 AM »
Hi.
I tried to google for some code sample to change this in code, but could not find anything.

if you can find a sample script i can make an action for it.

Kubold

  • Full Member
  • ***
  • Posts: 112
Re: Fixed time step
« Reply #10 on: September 07, 2020, 07:54:50 AM »
Hi, I found this:

Time.fixedDeltaTime = 1.0f/(float)PhysicsFrameRate;
Time.maximumDeltaTime = Time.fixedDeltaTime * 2.0f;
Application.targetFrameRate = TargetFrameRate;

from this forum post: https://forum.unity.com/threads/cannot-seem-to-set-maximum-allowed-timestep-from-script.432147/

Is this helpful in any way? I don't know much about coding but maybe it's the "Time.maximumDeltaTime" that refers to Maximum Allowed Timestep.
« Last Edit: September 07, 2020, 08:30:28 AM by Kubold »

Kubold

  • Full Member
  • ***
  • Posts: 112
Re: Fixed time step
« Reply #11 on: September 07, 2020, 08:45:46 AM »
Nevermind! I managed to "hack" the original Action and it works :)
I attach the "Set Maximum Allowed Time Step" Action.