You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A bit over a week ago on the Discord, I mentioned wanting to make the force and impulse components not required. This is still true, but I've been thinking that the force API might also be sorely in need of a rework in general.
The "persistent" vs. "not persistent" force split is confusing. You can't even apply both at the same time.
Why do impulses (intended to be "instantaneous") use components, and why do they support persistence?
The coordinate spaces are confusing and implicit, and applying local forces or torque (especially persistently) is a pain.
Keeping forces and torque in separate components means that ExternalForcealso needs to store a torque, just because of apply_force_at_point.
I'm still in the brainstorming phase, but I was thinking that we probably want a way to just call apply_force, apply_local_force, apply_linear_impulse, and so on without having to mess with components in the API. One idea I was playing around with is a ForceHelper system param:
Internally, it can use components, commands, or whatever makes the most sense for a given method. I think this is a pretty nice and flexible approach, and perhaps closer to how you'd actually expect the force API to work. External forces and impulses are primarily an API abstraction for modifying velocity, not "a thing" a rigid body inherently has, so I think a system param approach makes sense.
In terms of the existing components, I think I would:
Remove ExternalImpulse and ExternalAngularImpulse in favor of just making ForceHelper able to apply instantaneous impulses.
Store forces and torque in the same component. This component could also store local forces and torque separately from world-space values.
Instead of the persistent property, we could have a separate ConstantForce or PersistentForce component. This would live in table storage, while the non-persistent version would be a SparseSet component that gets inserted whenever forces are applied, and removed when it is zero at the end of a physics timestep.
A-DynamicsRelates to rigid body dynamics: motion, mass, constraint solving, joints, CCD, and so onC-UsabilityA quality-of-life improvement that makes Avian easier to use
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
A bit over a week ago on the Discord, I mentioned wanting to make the force and impulse components not required. This is still true, but I've been thinking that the force API might also be sorely in need of a rework in general.
ExternalForce
also needs to store a torque, just because ofapply_force_at_point
.I'm still in the brainstorming phase, but I was thinking that we probably want a way to just call
apply_force
,apply_local_force
,apply_linear_impulse
, and so on without having to mess with components in the API. One idea I was playing around with is aForceHelper
system param:Internally, it can use components, commands, or whatever makes the most sense for a given method. I think this is a pretty nice and flexible approach, and perhaps closer to how you'd actually expect the force API to work. External forces and impulses are primarily an API abstraction for modifying velocity, not "a thing" a rigid body inherently has, so I think a system param approach makes sense.
In terms of the existing components, I think I would:
ExternalImpulse
andExternalAngularImpulse
in favor of just makingForceHelper
able to apply instantaneous impulses.persistent
property, we could have a separateConstantForce
orPersistentForce
component. This would live in table storage, while the non-persistent version would be aSparseSet
component that gets inserted whenever forces are applied, and removed when it is zero at the end of a physics timestep.Beta Was this translation helpful? Give feedback.
All reactions