Package com.jme3.scene.debug.custom
Class ArmatureNode
java.lang.Object
com.jme3.scene.Spatial
com.jme3.scene.Node
com.jme3.scene.debug.custom.ArmatureNode
- All Implemented Interfaces:
HasLocalTransform
,CloneableSmartAsset
,Collidable
,Savable
,JmeCloneable
,Cloneable
Renders an
Armature
for debugging purposes. It can display either
wires connecting the heads of bones (if no length data is available) or
full bone shapes (from head to tail) when length data is supplied.-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.scene.Spatial
Spatial.BatchHint, Spatial.CullHint, Spatial.DFSMode
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final float
The size of the picking box in pixels for joint selection.Fields inherited from class com.jme3.scene.Spatial
batchHint, controls, cullHint, frustrumIntersects, key, localLights, localOverrides, localTransform, name, parent, queueBucket, queueDistance, refreshFlags, RF_BOUND, RF_CHILD_LIGHTLIST, RF_LIGHTLIST, RF_MATPARAM_OVERRIDE, RF_TRANSFORM, shadowMode, userData, worldBound, worldLights, worldOverrides, worldTransform
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
collideWith
(Collidable other, CollisionResults results) protected final void
createSkeletonGeoms
(Joint joint, Node joints, Node wires, Node outlines, List<Joint> deformingJoints) Recursively creates the geometries for a given joint and its children.protected Joint
Returns the currently selected joint.int
pick
(Vector2f cursor, CollisionResults results) Performs a 2D pick operation to find joints or bones near the given cursor position.protected Joint
Selects a joint based on its associated geometry.void
Sets the camera to be used for 2D picking calculations.void
setHeadColor
(Joint joint, ColorRGBA color) Sets the color of the head geometry for a specific joint.void
setHeadColor
(ColorRGBA color) Sets the color of all joint head geometries.void
setLineColor
(ColorRGBA color) Sets the color of all bone line geometries.void
The method updates the geometry according to the positions of the bones.protected final void
updateSkeletonGeoms
(Joint joint) Updates the geometries associated with a given joint and its children to reflect their current model transforms.Methods inherited from class com.jme3.scene.Node
attachChild, attachChildAt, breadthFirstTraversal, clone, cloneFields, deepClone, depthFirstTraversal, descendantMatches, descendantMatches, descendantMatches, detachAllChildren, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, oldDeepClone, read, setLightListRefresh, setLodLevel, setMaterial, setMatParamOverrideRefresh, setModelBound, setParent, setTransformRefresh, swapChildren, updateGeometricState, updateLogicalState, updateModelBound, updateWorldBound, write
Methods inherited from class com.jme3.scene.Spatial
addControl, addControlAt, addLight, addMatParamOverride, breadthFirstTraversal, center, checkCulling, clearMatParamOverrides, clone, depthFirstTraversal, forceRefresh, getBatchHint, getControl, getControl, getCullHint, getKey, getLastFrustumIntersection, getLocalBatchHint, getLocalCullHint, getLocalLightList, getLocalMatParamOverrides, getLocalQueueBucket, getLocalRotation, getLocalScale, getLocalShadowMode, getLocalToWorldMatrix, getLocalTransform, getLocalTranslation, getName, getNumControls, getParent, getQueueBucket, getShadowMode, getUserData, getUserDataKeys, getWorldBound, getWorldLightList, getWorldMatParamOverrides, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, jmeClone, localToWorld, lookAt, matches, move, move, oldClone, removeControl, removeControl, removeFromParent, removeLight, removeMatParamOverride, rotate, rotate, rotateUpTo, runControlRender, scale, scale, setBatchHint, setBoundRefresh, setCullHint, setKey, setLastFrustumIntersection, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalScale, setLocalTransform, setLocalTranslation, setLocalTranslation, setName, setQueueBucket, setRequiresUpdates, setShadowMode, setUserData, toString, updateMatParamOverrides, updateWorldLightList, updateWorldTransforms, worldToLocal
-
Field Details
-
PIXEL_BOX
public static final float PIXEL_BOXThe size of the picking box in pixels for joint selection.- See Also:
-
-
Constructor Details
-
ArmatureNode
public ArmatureNode(Armature armature, Node joints, Node wires, Node outlines, List<Joint> deformingJoints) Creates a wire with bone lengths data. If the data is supplied then the wires will show each full bone (from head to tail).- Parameters:
armature
- the armature that will be shownjoints
- the Node to visualize jointswires
- the Node to visualize wiresoutlines
- the Node to visualize outlinesdeformingJoints
- a list of joints
-
-
Method Details
-
createSkeletonGeoms
protected final void createSkeletonGeoms(Joint joint, Node joints, Node wires, Node outlines, List<Joint> deformingJoints) Recursively creates the geometries for a given joint and its children.- Parameters:
joint
- The current joint for which to create geometries.joints
- The node for joint geometries.wires
- The node for bone wire geometries.outlines
- The node for bone outline geometries.deformingJoints
- A list of deforming joints.
-
setCamera
Sets the camera to be used for 2D picking calculations.- Parameters:
camera
- The camera to set.
-
select
Selects a joint based on its associated geometry. If the selected geometry is already the current selection, no change occurs. Resets the selection ifgeometry
is null.- Parameters:
geo
- The geometry representing the joint or bone to select.- Returns:
- The newly selected
Joint
, or null if no joint was selected or the selection was reset.
-
getSelectedJoint
Returns the currently selected joint.- Returns:
- The
Joint
that is currently selected, or null if no joint is selected.
-
updateSkeletonGeoms
Updates the geometries associated with a given joint and its children to reflect their current model transforms. This method is called recursively.- Parameters:
joint
- The joint to update.
-
setHeadColor
Sets the color of the head geometry for a specific joint.- Parameters:
joint
- The joint whose head color is to be set.color
- The new color for the joint head.
-
setHeadColor
Sets the color of all joint head geometries.- Parameters:
color
- The new color for all joint heads.
-
setLineColor
Sets the color of all bone line geometries.- Parameters:
color
- The new color for all bone lines.
-
pick
Performs a 2D pick operation to find joints or bones near the given cursor position. This method primarily checks for joint heads within aPIXEL_BOX
box around the cursor, and then checks for bone wires.- Parameters:
cursor
- The 2D screen coordinates of the pick ray origin.results
- TheCollisionResults
to store the pick results.- Returns:
- The number of collisions found.
-
collideWith
Collides thisArmatureNode
with aCollidable
object, typically aRay
. It prioritizes 2D picking for joint heads and then performs a distance-based check for bone wires.- Specified by:
collideWith
in interfaceCollidable
- Overrides:
collideWith
in classNode
- Parameters:
other
- TheCollidable
object to collide with.results
- TheCollisionResults
to store the collision information.- Returns:
- The number of collisions found.
-
updateGeometry
public void updateGeometry()The method updates the geometry according to the positions of the bones.
-