Overview:
Delta time in physics update previously had a scale of 60 due to a prior fix regarding timestep.
This change removes the scaling of physics timestep by 60, and adjusts velocities / forces (gravity) to account for this so behavior does not change.
Impact: Will help with ragdoll work I am doing, velocity metadata can be used with objects simulated in rapier and on our kinematics without having to get messy scaling them back and forth, or dealing with a very large timestep in rapier (which did not go well in my experiments).
units of velocity and gravity now relate more intuitively to position + sizes of objects in terms of setting velocity based on how far a contributor may want something to move per second.
Changes:
velocities all scaled up by 60, gravity scaled up by 3600 (60*60) as this is multiplied by time twice.
Gravity values are now quite large, unless we want to change unit of gravity and add back in a magic scale factor will have to roll with this I guess. I think it's ok this way, new contributors may reference global gravity metadata to get an idea of what to set a specific body's gravity to.
apply_rotation now uses delta time (kinematic rotations should now be consistent regardless of frame rate)
Fix bullet position update from velocity not being scaled by delta time
Fix setting velocity.y = 0 when grounded comparing against global gravity (now corrected to use body's gravity)
Fix sproinger velocity condition including gravity incorrectly (don't think we need gravity in this at all)
Other Notes:
I am hoping I caught all of the values that needed updating. Testing movement / jump, throwing items, sproinger, bomb bounces, it looks right to me.
One thing I noticed is that some item metadata includes a "angular_velocity" value which is used as spin factor for item throw. Spin scales based on the throw velocity, so these spin values do not need to be updated. This is more of a spin factor than a true angular velocity, may consider renaming in future.
There are a few values hard coded that we could pull into metadata, but I didn't want to make footprint of change any larger than necessary.
some metadata for player movement is duplicated between player skin metadata, may want to pull this out to single metadata location in future.
Overview: Delta time in physics update previously had a scale of 60 due to a prior fix regarding timestep.
This change removes the scaling of physics timestep by 60, and adjusts velocities / forces (gravity) to account for this so behavior does not change.
Impact: Will help with ragdoll work I am doing, velocity metadata can be used with objects simulated in rapier and on our kinematics without having to get messy scaling them back and forth, or dealing with a very large timestep in rapier (which did not go well in my experiments).
units of velocity and gravity now relate more intuitively to position + sizes of objects in terms of setting velocity based on how far a contributor may want something to move per second.
Changes:
Other Notes: I am hoping I caught all of the values that needed updating. Testing movement / jump, throwing items, sproinger, bomb bounces, it looks right to me.