Kindly explain briefly to me. I didn’t catch findGeom works and PhysicsSpace. Thanks in advance!
[patch] private PhysicsSpace getPhysicsSpace() {
return bulletAppState.getPhysicsSpace();
}
private Geometry findGeom(Spatial spatial, String name) {
if (spatial instanceof Node) {
Node node = (Node) spatial;
for (int i = 0; i < node.getQuantity(); i++) {
Spatial child = node.getChild(i);
Geometry result = findGeom(child, name);
if (result != null) {
return result;
}
}
} else if (spatial instanceof Geometry) {
if (spatial.getName().startsWith(name)) {
return (Geometry) spatial;
}
}
return null;
}[/patch]
Nodes and geometries are spatials, One node might have several spatials, and those spatials might be geometries. The findGeo() is a recursive method, it goes down the hierarchy and try to find the a geometry with the given name.
Physics Space is like a node, but instead of attaching any kinda spatial to it, you attach rigid bodies(spatials controlled by rigid body controls). If the the rigid bodies are in physics space, their physics starts.
For Scene Graph read this :
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies
For Physics read this :
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:physics
EDIT: Also, bulletAppState is the app state where is the physics space. About app states read this : https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:application_states
I’ve have one question, what do Spatial means? I’ve looked at the dictionary what does it mean but dictionary and encyclopedia that i had opened dont have a meaning.
Spatials are all is inside the scene graph. Spatials are nodes, geometries, skyboxes, particle emmiters, etc.
Yeah! I understand now. Thanks!