NVIDIAGameWorks / FleX

Other
646 stars 99 forks source link

How to load animation on collision shape? #92

Open rozentill opened 4 years ago

rozentill commented 4 years ago

Hi,

I wonder if we can load our own animation on a collision shape. For example an human body animation on triangle mesh for cloth simulation.

Thank you!

Dzhange commented 4 years ago

Hi,

I wonder if we can load our own animation on a collision shape. For example an human body animation on triangle mesh for cloth simulation.

Thank you!

Have you made any progress? I'm also confused by this.

Gfans commented 4 years ago

Hi, I wonder if we can load our own animation on a collision shape. For example an human body animation on triangle mesh for cloth simulation. Thank you!

Yes, it is possible. You can use NvFlexSetShapes to update collision shapes (capsules, convex, tri mesh, etc.) each frame. Just make sure triangle meshes are updated according to the animation.

rozentill commented 4 years ago

Hi, I wonder if we can load our own animation on a collision shape. For example an human body animation on triangle mesh for cloth simulation. Thank you!

Yes, it is possible. You can use NvFlexSetShapes to update collision shapes (capsules, convex, tri mesh, etc.) each frame. Just make sure triangle meshes are updated according to the animation.

Hi @Gfans , thank you for your reply, but what should I set for shapePositions, shapeRotations, shapePrevPositions and shapePrevRotations? As the description of the API:

/**
 * Set the collision shapes for the solver
 * 
 * @param[in] solver A valid solver
 * @param[in] geometry Pointer to a buffer of NvFlexCollisionGeometry entries, the type of each shape determines how many entries it has in the array
 * @param[in] shapePositions Pointer to a buffer of translations for each shape in world space, should be 4*numShapes in length
 * @param[in] shapeRotations Pointer to an a buffer of rotations for each shape stored as quaternion, should be 4*numShapes in length
 * @param[in] shapePrevPositions Pointer to a buffer of translations for each shape at the start of the time step, should be 4*numShapes in length
 * @param[in] shapePrevRotations Pointer to an a buffer of rotations for each shape stored as a quaternion at the start of the time step, should be 4*numShapees in length
 * @param[in] shapeFlags The type and behavior of the shape, NvFlexCollisionShapeFlags for more detail
 * @param[in] numShapes The number of shapes
 *
 */

the positions mean a buffer of translations for each shape, the length should be 4*numShapes. However I only have one shape but the positions of different vertices are changing during the animation, does this still work?

jby1993 commented 4 years ago

Hi, @rozentill @Gfans. I use NvFlexSetShapes to update collision triangles, and it works. But the collision between cloth and animated body is not stable. The cloth is very easy to penetrate into the body, and the simulation is fail. Does any method to handle this?

rozentill commented 4 years ago

Hi, @rozentill @Gfans. I use NvFlexSetShapes to update collision triangles, and it works. But the collision between cloth and animated body is not stable. The cloth is very easy to penetrate into the body, and the simulation is fail. Does any method to handle this?

Hi @jby1993 , thank you for your information, but I wonder what did you set for position and rotation, do you set the positions to be the vertices' coordinates and leave rotation to be identity?

Dzhange commented 4 years ago

Hi, @rozentill @Gfans. I use NvFlexSetShapes to update collision triangles, and it works. But the collision between cloth and animated body is not stable. The cloth is very easy to penetrate into the body, and the simulation is fail. Does any method to handle this?

I have encountered the same problem with you, have you made any progress?

korzen commented 4 years ago

I am afraid that triangular meshes in Flex are meant for non-deforming meshes only. I experience similar problems when pouring adhesive fluid on deforming triangular meshes

Dzhange commented 4 years ago

Bad news for me... do you have any alternative simulation engine?

iamyourgod commented 3 years ago

Hi, @rozentill @Gfans. I use NvFlexSetShapes to update collision triangles, and it works. But the collision between cloth and animated body is not stable. The cloth is very easy to penetrate into the body, and the simulation is fail. Does any method to handle this?

I found the reason for this problem because ccd failed, but I didn't think of a solution. Can anyone solve this problem, or the author provides an API?