Playmaker Forum
PlayMaker News => General Discussion => Topic started by: PolyMad on September 27, 2018, 12:07:27 AM
-
As per title :o
-
Hi.
Not that i know of, can't find anything using time.deltatime in unity forums/docs
-
Correct me if I'm wrong: for what I know, the PER SECOND option exists to make the action framerate independent.
Now, if this option is missing here, the torque I add each frame will be framerate dependent, and this inevitably gives framerate based results.
-
Hi.
Add torque work differently i guess, with velocity there :
https://docs.unity3d.com/ScriptReference/Rigidbody-velocity.html
https://docs.unity3d.com/ScriptReference/Rigidbody.AddTorque.html
-
Mhhh you mean that Playmaker actions only add PER SECOND option only if Unity features the option itself?
-
Hi.
No not really.
Force and Torque is done in OnFixedUpdate() in the actions.
FixedUpdate is named such because it's called a fixed number of times per second. By default the interval is every 0.02 seconds, or 50 times every second. You can change this (if you'd like) by going to the Time Manager, Edit -> Project Settings -> Time.
Which means it is already doing this per second :)
-
Perfect, thank you veeery much, dude :-)
-
Back here!
I sincerely don't know if this is coming from Unity or Playmaker, but I am now SURE that ADD TORQUE is NOT frame independent.
In fact, if I activate the VSync, and fix the framerate at 60 fps, the vehicle behaves one way, if I deactivate VSync, the game runs at around 120 fps, and the vehicle behaves completely differently.
I am absolutely sure that at the moment things are not working as expected for the ADD TORQUE command (or Playmaker action).
"Luckily", I plan to fix the framerate of my game at 60 with VSync (there won't be an option to set it differently, and the game won't run differently), so I shouldn't have any problem anyway, but still it would be nice to know what is really happening.
-
Hi,
Yes, Torque can be applied per seconds, it's just not available in the action, that's all.
you can always do that manually, by multiplying your torque value by the deltatime, either manually or via the action PerSecond. So for any action that you want to turn into framerate independant, just use PerSecond prior.
anyway, I made an action for this on the Ecosystem: AddTorqueAdvanced.
Bye,
Jean
-
The AddTorqueAdvanced is a great idea, I was going to tell you that an Add Torque variable on the framerate doesn't make much sense, like ANY physics action that wouldn't be linked to time instead to framerate.
Honestly, I would cut away the old Add Torque and replace it with the new one, with just add the option to multiply with delta and that would be it.
-
Hi,
well, not really, because the best way when you want a constant rotation of a physic object is to set the velocity.
what are you trying to control? a wheel?
Bye,
Jean
-
Setting the velocity means sudden change to the object setting, but adding an acceleration means a more "faithful" change in the simulation.
Yes, I'm working on a vehicle simulation.
By using Add Torque, I don't need to deal with a lot of stuff, I only set up rightly the wheels parameters and all I have to do is to add the torque when the player accelerates or brakes.
If I'd set the velocity I'd need to use curves and extra data.
At least, this is what I know, it's the first time I'm doing this, sooo... easily I'm not doing the best thing possible.
-
Hi,
for wheels, I strongly recommend using a proper vehicle simulator engine.
controlling velocity also means making sure the ramping curves are realistic, so indeed if you control using velocity, you need some math to accelerate, decelerate, etc etc.
but, yeah, now you have a custom action for this.
ideally, I think Playmaker should provide the everyframe with all the various options ( whicch update call, per seconds and in realtime or not), it would be great that this was built in, and not to be implemented on all actions)
Bye,
Jean
-
Trust me, if I could have used a simulation engine, I did.
The problem is that I HAVE to use cylinders as wheels and so there is literally NO ready solution in this direction.
I also think that at one point in development I will have to hire some specialist in physics to refine the simulation, because I'm not able to simulate the softness of the tire and the simulation simply breaks when going over 100 Kmh... but for now it's ok, the is working and fun even at lower speeds.
-
Hi,
uhm... what is the vehicle you are trying to simulate? One possible trick is to use different rig per speed and terrain, and you swith between them when necessary. so a regular wheel collider for high speed and a custom cylinder for low speed and bumpy terrain, etc.
Bye,
Jean
-
The race is offroad high speed, the vehicles are continuously running at high and low speed on offroad and road tracks.
I really can't detach from cylinder wheel. This solution would become tricky to maintain, I need something easy to update on all the vehicles.
-
Hi,
I would totally make a very thorough research on what's already available, because wheel physics is very complex indeed:
https://forum.unity.com/threads/wheel-controller-3d-customizable-three-dimensional-alternative-to-wheelcollider.441618/
I would contact each author you find that deals with advanced wheel collider, explain your case and check with them what's possible or not. And yes, for some advanced deals, an expert is likely the way to go for your core.
Bye,
Jean
-
Thank you, I didn't know this, it may work for me.
Just checking if it can be applied to complex configuration vehicles, because my vehicles are a bit different from the standard "box+wheels" that are common vehicles.