Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Microck on December 21, 2019, 08:22:30 AM

Title: Set rotation advanced - Fixed Update doesn't work
Post by: Microck 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 ?
Title: Re: Set rotation advanced - Fixed Update doesn't work
Post by: jeanfabre 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
Title: Re: Set rotation advanced - Fixed Update doesn't work
Post by: Microck 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.  :)
Title: Re: Set rotation advanced - Fixed Update doesn't work
Post by: jeanfabre 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