Advertisement

Slow Motion Game Effect

Started by March 29, 2018 04:36 PM
1 comment, last by samoan62 6 years, 8 months ago

Hello all!

I'm in the process of creating a 2d side scroller game using the unity game engine with the C# programming language. I'm creating "boosters" for the main character, one of which is the ability to slow down time. When time slows, everything moves slowler EXCEPT for the main character. Getting time to slow down is easy enough (Time.TimeScale = .5f), but I'm struggling with keeping the main character from slowing down as well. The main character moves using the physics engine by applying force:

rigidbody2d.Addforce(new Vector2 (moveForce, 0), ForceMode2d.Force)

I'm not sure if I need to scale the amount of force applied to the character, and, if so, what the coding would look like. Any thoughts and insight would be most appreciated!

Time.TimeScale in unity effects the physics of all rigid bodies. You can't target any in particular, so I think you are on the right track with this.

In theory doubling the force on an object while halving the time scale should result in the same resultant velocity, but I think you maybe should be shooting for the same change of displacement over time instead in which case you should quadruple the force. I would be interested to see how unity would handle this and what it would do. I suppose you should also be comfortable making the assumption that only force vectors acting on your game object are moving it. This includes gravity and friction as well, you would need to apply the same multipliers to them.

This topic is closed to new replies.

Advertisement