Posts: 10
Threads: 4
Joined: Jun 2024
Reputation:
0
Hi!
Under your guidance, I was able to clamp the soft body with the rigid body. This effect is very good and meets our needs.
In our further requirements, we hope to use ArticulationBody to replace Rigidbody. In fact, ArticulationBody does not seem to be compatible with Obi.
Therefore, I hope to simulate the reaction force of the soft body in physical collision, so as to manually apply the reaction force to ArticulationBody.
In the collision-related documents, it is mentioned that developers can obtain the impulse of the collision.
For the above purpose, I collected this impulse information in the collision callback.
In my previous attempt, I directly used the impulse as the reaction force of the collision, but it seems that this is not the case.
I would like to ask if there is a way to convert the collision impulse into a reaction force.
Sorry, my physics is not very good. Thank you for your help.
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
16-07-2024, 09:31 AM
(This post was last modified: 16-07-2024, 09:31 AM by josemendez.)
(16-07-2024, 08:24 AM)wenhao_zheng Wrote: Hi!
Under your guidance, I was able to clamp the soft body with the rigid body. This effect is very good and meets our needs.
In our further requirements, we hope to use ArticulationBody to replace Rigidbody. In fact, ArticulationBody does not seem to be compatible with Obi.
Hi!
Correct, Obi only implements rigidbodies but not articulation bodies.
(16-07-2024, 08:24 AM)wenhao_zheng Wrote: I would like to ask if there is a way to convert the collision impulse into a reaction force.[/b]
Simply divide by time squared. In Obi's case, "time" is the duration of a substep. Sample pseudocode, assuming you're using ObiFixedUpdater:
Code: force = lambdaImpulse / (Mathf.Pow(Time.fixedDeltaTime / ObiFixedUpdater.substeps, 2));
kind regards,
Posts: 10
Threads: 4
Joined: Jun 2024
Reputation:
0
(16-07-2024, 09:31 AM)josemendez Wrote: Hi!
Correct, Obi only implements rigidbodies but not articulation bodies.
Simply divide by time squared. In Obi's case, "time" is the duration of a substep. Sample pseudocode, assuming you're using ObiFixedUpdater:
Code: force = lambdaImpulse / (Mathf.Pow(Time.fixedDeltaTime / ObiFixedUpdater.substeps, 2));
kind regards,
Thanks!
By the way, there seems to be no explicit Updater component in Obi7.
Is Fixupdater used by default in the underlying simulation?
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
16-07-2024, 11:33 AM
(This post was last modified: 16-07-2024, 11:36 AM by josemendez.)
(16-07-2024, 11:33 AM)wenhao_zheng Wrote: Thanks!
By the way, there seems to be no explicit Updater component in Obi7.
Is Fixupdater used by default in the underlying simulation?
Yes, fixed update is used by default in Obi 7. Substeps are a property of the solver instead of the updater, since explicit updaters are no longer needed.
Posts: 10
Threads: 4
Joined: Jun 2024
Reputation:
0
(16-07-2024, 11:33 AM)josemendez Wrote: Yes, fixed update is used by default in Obi 7. Substeps are a property of the solver instead of the updater, since explicit updaters are no longer needed.
Thanks!!!
-------------------------------------------------------------
I am ashamed to say that I encountered another problem.
I obtained the sum of impulses at the collision point when ObiSoftbody and ObiRigidbody collided. And applied this sum of impulses to the Articulation Body with the same mass as ObiRigidbody.
Regardless of whether I converted the impulse to force or not, I felt that the momentum applied to the ArticulationBody was too large, and it knocked the contact rigid body away.
-------------------------------------------------------------
We don't need to discuss the difference between Unity Rigidbody or ArticulationBody first, because both use the same set of physical frameworks, and the parameters of the two are naturally of the same scale.
So I wonder if the impulse of the Obi physics engine has a scale difference from the impulse of the Unity physics engine.
-------------------------------------------------------------
At the same time, Obi can use ObiRigidbody to realize physical feedback to Unity Rigidbody.
So I am curious about how ObiRigidbody transfers the correct physical momentum to Rigidbody.
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
17-07-2024, 10:44 AM
(This post was last modified: 17-07-2024, 10:54 AM by josemendez.)
(17-07-2024, 10:28 AM)wenhao_zheng Wrote: So I wonder if the impulse of the Obi physics engine has a scale difference from the impulse of the Unity physics engine.
No, they are exactly the same. All units both in Unity and Obi use the International System: distances in meters, time in seconds and mass in kilograms, so forces in newtons and impulses in newton-seconds.
(17-07-2024, 10:28 AM)wenhao_zheng Wrote: So I am curious about how ObiRigidbody transfers the correct physical momentum to Rigidbody.
You can see the code for this in ObiBurstColliderCollisionConstraintsBatch.cs, line316:
Code: BurstMath.ApplyImpulse(rigidbodyIndex, -lambda / frameEnd * contact.normal, ...);
Note how it divides the lambda impulse (which is a lagrange multiplier, the value you get on your contact callbacks) by time (frameEnd) once, to convert it to a normal impulse. You would divide again to convert the lambda impulse to a force. Also note the negative sign since the contact normal points away from the surface of the rigidbody.
kind regards,
|