I know this question has been asked a lot, but non of the questions I came by had anything to do with collisions.
So here’s my question:
How can I predict the “resting-pose” of a rigidbody?
I would like to use this for forest generation with some trees falling over each other etc. Then I could just save those positions and rotations and delete the RB: optimization!
I know the basic physics calculations, but I know nothing about collisions affecting the angular velocity etc.
So is there a simple solution for this?
I guess not
By your first post I am starting to think that you want to know if there is a way to calculate the position and rotation where a rigidbody will be at some future point in time. If that is the case, then I am fairly certain that the engine simply does not have that information, because all physical motions are calculated in the following way:
- Move the rigidbody by a distance based on the current velocity and the fixed time step.
- After it was moved, check to see if it is in contact with another collider.
- If collision: calculate the new velocity based on the collision to prepare for next frame.
- If not collision: nothing happens, object keeps its current velocity, plus velocity modifications due to influence of gravity and drag (if they are active).
- Process repeats for the next frame.
The key here is that each rigidbody motion is calculated on a FixedUpdate step by step basis, and has no idea where it will be beyond the current step. The only way to figure out where a rigidbody will be after some period of time is by letting the rigidbody run it’s course. This kind of thing is exactly what rigidbodies are for.
That said, I suppose you could maybe calibrate a secondary rigidbody to run faster than is realistic, and attached to an invisible clone of your object. This would be a way to get a future position faster (but not instantly) technically speaking, but making it work realistically at a faster pace would be challenging. You would have to apply a custom gravity force to it, change the mass on it, and then in addition to the giant pain in the ass you’ve gone through, you haven’t actually optimized much, since you had to use a rigidbody to predict the future position and rotation anyway.