RigidBody.geometry should be an array/MFNode not object/SFNode in X3dToJson.xslt output
37.4.10 RigidBody
RigidBody : X3DNode, X3DBoundedObject {
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
SFBool [in,out] bboxDisplay 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,∞)
SFBool [in,out] enabled TRUE
SFVec3f [in,out] finiteRotationAxis 0 0 0 0 1 0 [-1,1]
SFBool [in,out] fixed FALSE
MFVec3f [in,out] forces []
** MFNode [in,out] geometry [] [X3DNBodyCollidableNode]**
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]
SFNode [in,out] metadata NULL [X3DMetadataObject]
SFRotation [in,out] orientation 0 0 1 0 [0,1]
SFVec3f [in,out] position 0 0 0 (-∞,∞)
MFVec3f [in,out] torques []
SFBool [in,out] useFiniteRotation FALSE
SFBool [in,out] useGlobalGravity TRUE
SFBool [in,out] visible TRUE
SFVec3f [] bboxCenter 0 0 0 (-∞,∞)
SFVec3f [] bboxSize -1 -1 -1 [0,∞) or -1 -1 -1
}
Example:
{ "RigidBody":
{
"@DEF":"BODY-1",
"@position":[0.0,2.0,0.0],
"-geometry":
{ "CollidableShape":
{
"@USE":"BALL-GEOM"
}
}
}
}
Likely desired output:
{ "RigidBody":
{
"@DEF":"BODY-1",
"@position":[0.0,2.0,0.0],
"-geometry": [
{ "CollidableShape":
{
"@USE":"BALL-GEOM"
}
}
]
}
}
I would say address the X3dtoJson.xslt issue first, but the X3DJSAIL schematron is also important (below).
Error invalid file BounceTrimesh.x3dj
keyword: type
location in document: /X3D/Scene/-children/4/RigidBodyCollection/-bodies/0/RigidBody/-geometry
message: must be array
params: {"type":"array"}
file: BounceTrimesh.x3dj
A main problem with X3DJSAIL seems to be:
java.lang.ClassCastException: class org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape cannot be cast to class org.web3d.x3d.sai.Grouping.X3DGroupingNode
Which is undersandable, since CollidableShape not an X3DGroupingNode by my reading. it looks like it's a parent of Shape.
CollidableShape : X3DNBodyCollidableNode {
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]
}
X3DJSAIL output (sorry, long)
$ java -cp ~/X3DJSONLD/X3DJSAIL.4.0.full.jar org.web3d.x3d.jsail.CommandLine -validate BounceTrimesh.x3d
CommandLine parameter: "-validate" for model validation
parameter: source file BounceTrimesh.x3d filesize 4863 bytes
Parsing XML-encoded file using Document Object Model (DOM) based X3DLoaderDOM...
[X3DLoaderDOM] <meta name="warning" content="under development">
[error] X3DLoaderDOM: Parent-child node relationship not found! (parent CollidableShape, child Shape, containerField='shape')
Please report this problem to don.brutzman@gmail.com
[error] X3DLoaderDOM: Incorrectly handled X3DJSAIL object construction, current elementObject=CollidableShape (CollidableShape), child="Shape", containerField="shape", java.lang.ClassCastException: class org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape cannot be cast to class org.web3d.x3d.sai.Grouping.X3DGroupingNode (org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape and org.web3d.x3d.sai.Grouping.X3DGroupingNode are in unnamed module of loader 'app')
This error can be caused by
a. an internal error in Xj3DJSAIL X3DloaderDOM, or
b. model error, incorrect parent-child node relationships, or
c. incorrect containerField values in the XML model source.
X3D node typing is strict, make sure you check or validate your scene graph!
Please report mysterious problems, thank you.
java.lang.ClassCastException: class org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape cannot be cast to class org.web3d.x3d.sai.Grouping.X3DGroupingNode (org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape and org.web3d.x3d.sai.Grouping.X3DGroupingNode are in unnamed module of loader 'app')
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:1449)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:529)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:490)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:272)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:238)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:211)
at org.web3d.x3d.jsail.CommandLine.run(CommandLine.java:973)
at org.web3d.x3d.jsail.CommandLine.main(CommandLine.java:244)
[error] X3DLoaderDOM: Parent-child node relationship not found! (parent CollidableShape, child Shape, containerField='shape')
Please report this problem to don.brutzman@gmail.com
[error] X3DLoaderDOM: Incorrectly handled X3DJSAIL object construction, current elementObject=CollidableShape (CollidableShape), child="Shape", containerField="shape", java.lang.ClassCastException: class org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape cannot be cast to class org.web3d.x3d.sai.Grouping.X3DGroupingNode (org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape and org.web3d.x3d.sai.Grouping.X3DGroupingNode are in unnamed module of loader 'app')
This error can be caused by
a. an internal error in Xj3DJSAIL X3DloaderDOM, or
b. model error, incorrect parent-child node relationships, or
c. incorrect containerField values in the XML model source.
X3D node typing is strict, make sure you check or validate your scene graph!
Please report mysterious problems, thank you.
java.lang.ClassCastException: class org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape cannot be cast to class org.web3d.x3d.sai.Grouping.X3DGroupingNode (org.web3d.x3d.jsail.RigidBodyPhysics.CollidableShape and org.web3d.x3d.sai.Grouping.X3DGroupingNode are in unnamed module of loader 'app')
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:1449)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:529)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:490)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:272)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:238)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:211)
at org.web3d.x3d.jsail.CommandLine.run(CommandLine.java:973)
at org.web3d.x3d.jsail.CommandLine.main(CommandLine.java:244)
Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException: *** Found invalid value, containerField='geometry', legal values for CollidableShape are containerField_ALLOWED_VALUES='"children"'
see https://www.web3d.org/x3d/content/examples/X3dSceneAuthoringHints.html#containerField for more information.
at org.web3d.x3d.jsail.X3DConcreteNode.setContainerFieldOverride(X3DConcreteNode.java:443)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:679)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:666)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:529)
at org.web3d.x3d.jsail.X3DLoaderDOM.toX3dModelInstance(X3DLoaderDOM.java:490)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:272)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:238)
at org.web3d.x3d.jsail.X3DLoaderDOM.loadModelFromFileX3D(X3DLoaderDOM.java:211)
at org.web3d.x3d.jsail.CommandLine.run(CommandLine.java:973)
at org.web3d.x3d.jsail.CommandLine.main(CommandLine.java:244)
yottzumm@yottzumm-MacBookAir:~/X3DJSONLD/src/main/physics$
Diff: