Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suggestion / Idea  ArticulationBody support
#2
(26-03-2020, 11:45 AM)fiasko Wrote: Hey there, 

I'm not sure if you are aware of the new type of rigidbody: ArticulationBody. It's discussed in greater detail here: https://forum.unity.com/threads/feathers...ns.792294/

It's basically a new way of having super stable hierarchical joints for robotics and similar applications. I tried it with ObiRope and unsurprisingly, static interaction works. But I guess thats just the same as moving the transform of any collider with an ObiCollider component attached.

The API is similar to the one provided by the RigidBody, you can add torques and forces and read velocity and angularVelocity. Directly adding to the velocity or angularVelocity like it's done in ObiRigidbody is not possible because they're only getters.

I also tried to get working that the Rope is dragged along the surface of moving ArticulationBody. For that, I copied ObiRigidbody to a new ObiArticulationBody class and removed the code from UpdateVelocities(). Finally I added a method overload for Oni.Rigidbody.Set(UnityEngine.ArticulationBody) (in Oni.cs), that reads the velocity and angularVelocity and removed the rotation axis constraints code.

Code:
public void Set(UnityEngine.ArticulationBody source, bool kinematicForParticles){

   bool kinematic = !Application.isPlaying || kinematicForParticles;

   rotation = source.transform.rotation;
   linearVelocity = kinematicForParticles ? Vector3.zero : source.velocity;
   angularVelocity = kinematicForParticles ? Vector3.zero : source.angularVelocity;

   // center of mass in unity is affected by local rotation and position, but not scale.
   // We need it expressed in world space:
    centerOfMass = source.transform.position + rotation * source.centerOfMass;

   Vector3 invTensor = new Vector3(
       1/source.inertiaTensor.x,
       1/source.inertiaTensor.y,
    1/source.inertiaTensor.z);

   // the inertia tensor is a diagonal matrix (Vector3) because it is expressed in the
   // space generated by the principal axes of rotation (inertiaTensorRotation).
   inertiaTensor = kinematic ? Vector3.zero : invTensor;
    inertiaRotation = source.inertiaTensorRotation;
    inverseMass = kinematic ? 0 : 1/source.mass;

}

Hi,

I'm aware of the new articulated bodies. We've yet to decide what we'll do regarding support, seems doable, save for two-way interaction.

But at the same time, the Unity Physics engine (DOTS) also needs to be supported, and Havok. Supporting each of these requires to invest a lot of time, and I feel it's still pretty unclear the role each one will play. People might adopt DOTS as the default, go-to physics solution, the built-in PhysX integration might linger around for quite some time (or not), may be replaced by Havok, or all 3 could coexist. Also PhysX 5 will be released soon with built-in FEM and particle physics support, I wonder if Unity will adopt it (they're still integrating Physx 4, so it may pay off for them to jump to 5 directly)... it all adds up to a confusing and uncertain future.

Once things clear up a little bit we will decide where to put our efforts. For the time being, we're porting the core engine of Obi to Burst+Jobs, for future-proofing, better platform support, as well as tighter integration with Unity:
http://blog.virtualmethodstudio.com/2020...nds-burst/

(26-03-2020, 11:45 AM)fiasko Wrote: However, the rope that I put on top of a moving Cube is not dragged along. Any ideas?

How are you moving the cube? If you're simply changing its transform, remember that this is basically "teleporting" as far as the physics engine is concerned. No friction will be applied whatsoever. If using forces/impulses or setting its velocity, it definitely should drag the rope along.
Reply


Messages In This Thread
ArticulationBody support - by fiasko - 26-03-2020, 11:45 AM
RE: ArticulationBody support - by josemendez - 26-03-2020, 12:29 PM
RE: ArticulationBody support - by fiasko - 26-03-2020, 02:01 PM
RE: ArticulationBody support - by josemendez - 26-03-2020, 04:30 PM
RE: ArticulationBody support - by fiasko - 26-03-2020, 04:49 PM
RE: ArticulationBody support - by josemendez - 26-03-2020, 04:55 PM
RE: ArticulationBody support - by fiasko - 26-03-2020, 09:54 PM