playMaker

Author Topic: Set rotation advanced - Fixed Update doesn't work  (Read 728 times)

Microck

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Set rotation advanced - Fixed Update doesn't work
« on: December 21, 2019, 08:22:30 AM »
Hello !  :)
I get the "Set rotation advanced" on the ecosystem.
I tick "Everyframe" and set the update type to "On fixed update" but it doesn't work.

Some actions have the fixedUpdate option like the "Rotate" action and while it's perfectly working with "Rotate" (same rotate speed regardless of the FPS), it's not the case with "Set rotation advanced" (rotations in 60fps are slower than in 100fps).

Any idea on how to fix this issue ?
« Last Edit: December 21, 2019, 05:23:45 PM by Microck »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15489
  • Official Playmaker Support
    • View Profile
Re: Set rotation advanced - Fixed Update doesn't work
« Reply #1 on: December 23, 2019, 07:58:12 AM »
Hi,

 there is not much that can be done in this action to account for this, the code executes on fixedupdate.

 I think it's your computation prior this action that has a problem, how do you compute the rotation you are setting with this action? you'll need to use fixed deltat time to get it to work correctly.

https://docs.unity3d.com/ScriptReference/Time-fixedDeltaTime.html

I just made an action to get this value on the ecosystem, "getFixedDeltatime".

 let me know how it goes.

Bye,

 Jean

Microck

  • Playmaker Newbie
  • *
  • Posts: 12
    • View Profile
Re: Set rotation advanced - Fixed Update doesn't work
« Reply #2 on: December 23, 2019, 08:30:48 AM »
Hello !
Here's the computation prior this action:
http://img114.xooimage.com/files/7/a/4/look-56e30b0.jpg
The strange things is that if i replace the action "set rotation advanced" by the "rotate" action and tick fixedUpdate, it works fine without bothering with the DeltaTime.
"getFixedDeltatime" give me 0,02. I will try to include this data into my code, don't know how... but let's find out.  :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15489
  • Official Playmaker Support
    • View Profile
Re: Set rotation advanced - Fixed Update doesn't work
« Reply #3 on: December 24, 2019, 02:05:36 AM »
Hi,

 you don't need fixedupdate here at all. Do it on regular update.

FixedUpdate is when you want to control physics objects properties and flow with the physics engine without disrupting its calculation.

if you want to rotate a physics object, then you torque, or SetRigidBodyRotation custom action which rotates the rigidbody component, not the transform ( which is different internally for the physics engine)

Bye,

 Jean

Bye,

 Jean