Search Feedback

31
votes

Variable to alter Rigidbody simulation speed (Rigidbody.simulationSpeed)

Physics

-

-

It would nice to have access to a variable which dictates the simulation speed of a Rigidbody. There is currently no way to speed up or slow down a Rigidbody without meddling all simulations with Time.timeScale. Modifying that ripples through the rest of the engine affecting Mechanim playback and Particle System simulations.

In my research and testing I could not find a way to simulate individual or groups of Rigidbodies at various speeds. This includes dirty hacks with calculating your own gravity, friction, etc, and with trickery using Rigidbody.Sleep() and Rigidbody.WakeUp() and manually setting Rigidbody.velocity (which is expressily mentioned as bad practice here: https://docs.unity3d.com/ScriptReference/Rigidbody-velocity.html).

Rigidbody.simulationSpeed would allow individual objects (and by extension groups of objects) to run at different simulation speeds without losing its proper velocity and the host of calculations that go with it. It applies well for games that use physics along with time-scaling effects or simply being used for pausing.

The proposed variable would work the same way ParticleSystem.MainModule.simulationSpeed (https://docs.unity3d.com/ScriptReference/ParticleSystem.MainModule-simulationSpeed.html)

Pros:
* Physics simulation can be independent from Time.timeScale
* Applicable for pausing game (without affecting Mechanim and other simulations)
* Enables certain gameplay mechanics (something akin to The Legend of Zelda: Breath of the Wild’s Stasis ability wherein velocity can be added while simulation speed is 0)

Cons:
* Could lead to additional overhead, especially for large physics simulations

Other’s in the past have asked for similar. (See post that appears to have lead to Physics.Simulate(float step) here: https://feedback.unity3d.com/suggestions/function-for-manually-simulating)

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(10797)

2D

(282)

Ads

(56)

AI & Navigation

(84)

Analytics

(133)

Animation

(396)

Asset Store

(356)

Asset Store Publisher

(17)

Assets

(544)

Audio

(185)

Cloud Build

(145)

Collaborate

(65)

Docs & Tutorials

(240)

Editor

(2513)

Everyplay

(19)

Game Performance Reporting

(22)

General

(981)

Graphics

(870)

GUI

(432)

Input

(173)

Licensing

(92)

Networking

(189)

Physics

(384)

Platforms

(442)

Profiling & Optimization

(85)

Runtime

(182)

Scripting

(1169)

Terrain

(172)

WebGL

(143)