- Home /
Individual slow motion rigidbodys
Hi,
I'm putting together a collection of time control scripts for slow-motion and the like, I have transform driven slow-motion working but I am stuck on how to do it with rigid-bodies.
What Ideas I have so far.
disable use gravity and add a scaled force manually.
scaling the velocity when the effect is started.
Any other Ideas,
Thanks for the help
Maurice
Answer by TheFish657 · Jul 17, 2016 at 12:12 PM
if you want slow motion then i reccommend that you use Time.timeScale and set it to something like 0.25f for it to slow down. For any objects which you want to have unaffected by the change you can use Time.unscaledDeltaTime which is timescale - independant
I have already got slowmotion working on transform driven motion, the question is specifically about physics and rigidbodies which is more complex,
Thanks for the suggestion anyway.
This works for physics too! Timescale slows down everything, not just transform driven movement
Yeah but not object independently. eg I have 2 balls and I want one to be in slow motion and the other not. Sorry if I wasn't clear.
Simply mutliply the speed of the object you want to not be in slow motion by time.unscaled*DeltaTime and that of the one you do want to be in slow motion by Time.deltaTime. If you are not already using deltaTime you will probsbly need to increase the speed of your object because Time.deltaTime == 1/FPS Timescale so if you're running 60FPS with a TimeScale of 0.25 then normal deltaTime will be equal to 0.064 whereas unscaledDeltaTime will be 0.016
@TheFish657 Thanks! I found a post from a long time ago that had a method, similar to yours but you scale by the difference from the previous timescale so it is not constantly slowing down. once I have it polished up a bit I will post it as answer, I just want to see if anything better comes along.