#Use rigidbody without allowing it to update position

1 messages · Page 1 of 1 (latest)

restive hare
#

This fix of yours doesn't really do anything, since rigidbodies update on the fixed timescale, and I believe this is both in Update() and in a for loop

#

What do you mean by "my application requires this update to be slightly finer"?

#

What you're creating isn't actually finer, because collisions aren't checked where you're updating the position

#

If you wanted finer rigidbody movement, decrease the fixed timestep

thick zinc
#

@restive hare

I don't understand your first point

Will note, I don't particularly care how accurate the collisions themselves are so long as they do indeed collide.

Decreasing the fixed timestep isn't a particularly viable solution. This is a 2-body gravity simulation with a fixed central body. Because the gravitational pull is only calculated once per fixed timestep, I miss out on the infinite number of acceleration steps in between each position, which means accuracy is lost - especially if the object is moving faster.

I can't record a video right now to demonstrate it, but I can see this by looking at how the orbital parameters change as the object moves. The period for instance should remain constant, but due to inaccuracies it changes slightly - especially as the object accelerates toward the central body.

So, the only part of this I need to be more accurate is the gravitational force on the orbiting object. I can do this by decreasing the timestep, but this has an undesirable negative performance affect. Instead, I've opted to calculate a number ('resolution') of steps between each frame based on the sqrMagnitude of the orbiting objects velocity. (resolution = this.rigidbody.velocity.sqrMagnitude * this.resolutionScale)

This requires I update the position manually in my own timestep, per object.

This allows slow orbiting objects to remain performant whereas fast orbiting objects stay accurate.

Also, I tried to accomplish this mathematically to avoid physics altogether (which is apparently possible) but I couldn't get it to work.

fringe gale
#

I'm confused. You understand that collision will be relatively low resolution

#

Also your integrator is crap no offense

#

use velocity verlet or rk4

thick zinc
thick zinc
restive hare
#

This might be a obvious suggestion, but did you set the collision updates on your rigidbodies to continuous?

fringe gale
#

MovePosition