x3dom / x3dom

X3DOM. A framework for integrating and manipulating X3D scenes as HTML5/DOM elements.
http://x3dom.org
Other
815 stars 271 forks source link

Understanding of the RigidBody specification #1219

Closed microaaron closed 2 months ago

microaaron commented 2 years ago

@brutzman I have submitted a comment form to Web3D, but I'm not sure if I can get a reply. So I left this comment here.

=======================================================================

Hi, I'm trying to improve x3dom. I am having difficulty when trying to connect x3d nodes to bullet physics engine. Since a RigidBody can contain multiple CollidableShapes, should I create one bullet object for this RigidBody or multiple bullet objects for multiple CollidableShapes? If multiple CollidableShapes contained in this RigidBody belong to different CollisionSpaces, how should we understand this situation? I think RigidBody should also belong to X3DNBodyCollidableNode, which should be a subclass of CollidableShape, so there is no need to additionally include CollidableShape in RigidBody. CollidableShape can be regarded as a static object, and RigidBody adds motion attributes based on CollidableShape. So the definition of RigidBody should be as follows:

37.4.10 RigidBody
RigidBody : CollidableShape {
  SFBool     [in,out] bboxDisplay FALSE
  SFBool     [in,out] enabled     TRUE
  SFNode     [in,out] metadata    NULL     [X3DMetadataObject]
  SFRotation [in,out] rotation    0 0 1 0  [0,1]
  SFVec3f    [in,out] translation 0 0 0    (-∞,∞)
  SFBool     [in,out] visible     TRUE
  SFVec3f    []       bboxCenter  0 0 0    (-∞,∞)
  SFVec3f    []       bboxSize    -1 -1 -1 [0,∞) or -1 -1 -1
  SFNode     []       shape       NULL     [Shape]

  SFFloat    [in,out] angularDampingFactor 0.001   [0,1]
  SFVec3f    [in,out] angularVelocity      0 0 0   (-∞,∞)
  SFBool     [in,out] autoDamp             FALSE
  SFBool     [in,out] autoDisable          FALSE

  SFVec3f    [in,out] centerOfMass         0 0 0   (-∞,∞)
  SFFloat    [in,out] disableAngularSpeed  0       [0,∞)
  SFFloat    [in,out] disableLinearSpeed   0       [0,∞)

  SFTime     [in,out] disableTime          0       [0,∞)

  SFVec3f    [in,out] finiteRotationAxis  0 1 0   [-1,1]
  SFBool     [in,out] fixed                FALSE
  MFVec3f    [in,out] forces               []

  SFMatrix3f [in,out] inertia            1 0 0
                                           0 1 0
                                           0 0 1
  SFFloat    [in,out] linearDampingFactor  0.001   [0,1]
  SFVec3f    [in,out] linearVelocity       0 0 0   (-∞,∞)
  SFFloat    [in,out] mass                 1       (0,∞)
  SFNode     [in,out] massDensityModel     NULL    [Sphere, Box, Cone]

  MFVec3f    [in,out] torques              []
  SFBool     [in,out] useFiniteRotation    FALSE
  SFBool     [in,out] useGlobalGravity     TRUE
}
andreasplesch commented 2 years ago

I would recommend posting to the x3d-public mailing list. Perhaps focus just on the first question: If multiple CollidableShapes contained in this RigidBody belong to different CollisionSpaces, how should we understand this situation?

It is best to provide a short example, and perhaps try it on several players.

X3D physics is not related to bullet AFAIK, it may predate bullet.

andreasplesch commented 2 years ago

Bullet 1.9 is from 2006, and x3d physics was introduced 2008. So the x3d component may have been influenced by bullet.

microaaron commented 2 years ago

It seems that X3D public can't receive my email. There is no email from me in X3D public archives

andreasplesch commented 2 years ago

Did you subscribe first: https://www.web3d.org/mailman/listinfo/x3d-public_web3d.org ?

microaaron commented 2 years ago

Did you subscribe first: https://www.web3d.org/mailman/listinfo/x3d-public_web3d.org ?

Thanks, I forgot to subscribe it.