Obi Official Forum
Actors not receiving friction from moving Obi Colliders - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Actors not receiving friction from moving Obi Colliders (/thread-2707.html)



Actors not receiving friction from moving Obi Colliders - NathanBrower - 18-01-2021

Hello Virtual Method Community!

I have been enjoying the Softbody asset for a while now, but recently I have encountered an unexpected behavior that I am hoping is not a limitation with the asset's capabilities. As the title suggests, softbody actors placed onto a moving Obi Collider do not move along with it. Both participants have been tested with different combinations of physics materials with varying degrees of friction (and even stickiness). 

Any ideas?  Sonrisa

[Image: SoftbodyNonFriction.gif]


RE: Actors not receiving friction from moving Obi Colliders - josemendez - 18-01-2021

(18-01-2021, 06:01 PM)NathanBrower Wrote: Hello Virtual Method Community!

I have been enjoying the Softbody asset for a while now, but recently I have encountered an unexpected behavior that I am hoping is not a limitation with the asset's capabilities. As the title suggests, softbody actors placed onto a moving Obi Collider do not move along with it. Both participants have been tested with different combinations of physics materials with varying degrees of friction (and even stickiness). 

Any ideas?  Sonrisa

[Image: SoftbodyNonFriction.gif]

If you’re moving the collider by setting its transform position, you’re not actually moving it in the physical sense of the word but teleporting it from frame to frame. Any physics engine will ignore friction in this case, as friction is a force that opposes relative movement between surfaces, and no force is acting upon the collider to move it. You can test this by placing a rigidbody cube on top of your moving colliders, Unity’s physics engine will ignore friction as well.

The simple answer is that you have to use forces
to move your colliders. That way, frictional forces will be accounted for. This is true for all existing physics engines, not just Obi.

See the included obstacle course sample scene. The rotating platforms at the end rotate via forces (torques), and as you can see there’s accurate friction going on:
https://youtu.be/xQeBA0H4b40

Alternatively, you can use kinematic rigidbodies. What’s important is that there must be a rigidbody in the collider, and movement must affect its linear/angular velocities.


RE: Actors not receiving friction from moving Obi Colliders - NathanBrower - 18-01-2021

(18-01-2021, 08:53 PM)josemendez Wrote: If you’re moving the collider by setting its transform position, you’re not actually moving it in the physical sense of the word but teleporting it from frame to frame. Any physics engine will ignore friction in this case, as friction is a force that opposes relative movement between surfaces, and no force is acting upon the collider to move it. You can test this by placing a rigidbody cube on top of your moving colliders, Unity’s physics engine will ignore friction as well.

The simple answer is that you have to use forces
to move your colliders. That way, frictional forces will be accounted for. This is true for all existing physics engines, not just Obi.

See the included obstacle course sample scene. The rotating platforms at the end rotate via forces (torques), and as you can see there’s accurate friction going on:
https://youtu.be/xQeBA0H4b40

Alternatively, you can use kinematic rigidbodies. What’s important is that there must be a rigidbody in the collider, and movement must affect its linear/angular velocities.

Ah thank you for your response! 

Right this makes perfect sense. I should have mentioned that I am using a kinematic rigidbody (with of course an Obi Rigidbody) and am doing the movement in fixed update. I am a bit confused however when you say that I can use a kinematic rigidbody with forces. My understanding is that these are mutually exclusive.


EDIT:

Of course, the solution is to simply use Rigidbody.MovePosition/Rotation. Forgive me for assuming the issue was within Obi rather than my implementation.

Again thanks for your help, and congrats on the excellent asset!


RE: Actors not receiving friction from moving Obi Colliders - josemendez - 19-01-2021

(18-01-2021, 09:35 PM)NathanBrower Wrote: I am a bit confused however when you say that I can use a kinematic rigidbody with forces. My understanding is that these are mutually exclusive.

Sorry for the confusion! I was in a bit of a hurry when I wrote my first reply, so I guess it wasn't very clear.

Kinematic/forces are indeed mutually exclusive. There's two options:

- A non-kinematic rigidbody, moved using AddForce() and AddTorque() (in force, velocity or impulse mode). Directly setting linear/angular velocities would also work.
- A kinematic rigidbody, moved using MovePosition and MoveRotation(). Note that these two methods won't work in a non-kinematic rigidbody (they won't affect its velocity).

The rigidbody component adds new properties to an object: linear/angular velocities and linear/angular masses (linear mass and inertia tensor). A collider with no rigidbody would not work in any case, as it would not have linear/angular velocities.

Why are velocities needed for friction? well, because friction is a force that strives to get the relative velocity along the plane tangent to the contact point between two bodies to be zero. If one object (in this case, the softbody) isn't moving and the other one (the collider) has zero velocity because we are just setting its position directly, the relative velocity between the two bodies is already zero and no friction will be applied.

Hope this clears it up a bit, let me know otherwise. cheers!