Package jme3utilities.minie
Class MyControlP
java.lang.Object
jme3utilities.minie.MyControlP
Utility methods that operate on scene-graph controls/spatials/subtrees that
may include physics controls.
- See Also:
-
MyControl
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canApplyPhysicsLocal
(com.jme3.scene.control.Control sgc) Check whether a scene-graph control implements applyPhysicsLocal().static boolean
canDisable
(com.jme3.scene.control.Control sgc) Check whether a scene-graph control implements isEnabled() and setEnabled().static String
describe
(com.jme3.scene.control.Control sgc) Generate a textual description of a scene-graph control.static void
disablePhysicsControls
(com.jme3.scene.Spatial subtree) Disable all physics controls added to the specified subtree of the scene graph.static void
enablePhysicsControls
(com.jme3.scene.Spatial subtree, PhysicsSpace space) Enable all physics controls added to the specified subtree of the scene graph and configure their physics spaces.static RigidBodyControl
findEnabledRbc
(com.jme3.scene.Spatial spatial) Access the first enabled RigidBodyControl added to a Spatial.static boolean
isApplyPhysicsLocal
(com.jme3.scene.control.Control sgc) Test whether the specified SGC applies physics coordinates to its spatial's local translation.static boolean
isEnabled
(com.jme3.scene.control.Control sgc) Test whether a scene-graph control is enabled.static boolean
isPhysical
(com.jme3.scene.Spatial spatial) Test whether a Spatial is physics-controlled.static float
mass
(com.jme3.scene.Spatial spatial) Return the mass of the specifiedSpatial
.static void
removeNonPhysicsControls
(com.jme3.scene.Spatial subtree) Remove all non-physics controls from the specified subtree of the scene graph.static void
setApplyPhysicsLocal
(com.jme3.scene.control.Control sgc, boolean newSetting) Alter whether the specified SGC applies physics coordinates to its spatial's local translation.static void
setEnabled
(com.jme3.scene.control.Control sgc, boolean newState) Alter the enabled state of a scene-graph control.
-
Field Details
-
logger
message logger for this class
-
-
Method Details
-
canApplyPhysicsLocal
public static boolean canApplyPhysicsLocal(com.jme3.scene.control.Control sgc) Check whether a scene-graph control implements applyPhysicsLocal().- Parameters:
sgc
- the Control to test (may be null, unaffected)- Returns:
- true if it's implemented, otherwise false
-
canDisable
public static boolean canDisable(com.jme3.scene.control.Control sgc) Check whether a scene-graph control implements isEnabled() and setEnabled().- Parameters:
sgc
- the Control to test (may be null, unaffected)- Returns:
- true if it's implemented, otherwise false
-
describe
Generate a textual description of a scene-graph control.- Parameters:
sgc
- instance to describe (not null, unaffected)- Returns:
- description (not null, not empty)
-
disablePhysicsControls
public static void disablePhysicsControls(com.jme3.scene.Spatial subtree) Disable all physics controls added to the specified subtree of the scene graph. Disabling these controls removes any collision objects they may have added to physics spaces. Note: recursive!- Parameters:
subtree
- (not null)
-
enablePhysicsControls
Enable all physics controls added to the specified subtree of the scene graph and configure their physics spaces. Note: recursive!- Parameters:
subtree
- (not null)space
- the PhysicsSpace to add to, or null for none
-
findEnabledRbc
Access the first enabled RigidBodyControl added to a Spatial.- Parameters:
spatial
- spatial to search (not null, unaffected)- Returns:
- the pre-existing control, or null if none found
-
isApplyPhysicsLocal
public static boolean isApplyPhysicsLocal(com.jme3.scene.control.Control sgc) Test whether the specified SGC applies physics coordinates to its spatial's local translation.- Parameters:
sgc
- which scene-graph control (may be null, unaffected)- Returns:
- true if applied to local translation, otherwise false
-
isEnabled
public static boolean isEnabled(com.jme3.scene.control.Control sgc) Test whether a scene-graph control is enabled.- Parameters:
sgc
- control to test (not null, unaffected)- Returns:
- true if the control is enabled, otherwise false
-
isPhysical
public static boolean isPhysical(com.jme3.scene.Spatial spatial) Test whether a Spatial is physics-controlled.- Parameters:
spatial
- spatial to test (not null, unaffected)- Returns:
- true if the spatial is controlled by physics, otherwise false
-
mass
public static float mass(com.jme3.scene.Spatial spatial) Return the mass of the specifiedSpatial
.- Parameters:
spatial
- which spatial to measure (not null, unaffected)- Returns:
- mass (>0) or zero for a static object
-
removeNonPhysicsControls
public static void removeNonPhysicsControls(com.jme3.scene.Spatial subtree) Remove all non-physics controls from the specified subtree of the scene graph. Note: recursive!- Parameters:
subtree
- (not null)
-
setApplyPhysicsLocal
public static void setApplyPhysicsLocal(com.jme3.scene.control.Control sgc, boolean newSetting) Alter whether the specified SGC applies physics coordinates to its spatial's local translation.- Parameters:
sgc
- control to alter (not null)newSetting
- true means enable the control, false means disable it
-
setEnabled
public static void setEnabled(com.jme3.scene.control.Control sgc, boolean newState) Alter the enabled state of a scene-graph control.- Parameters:
sgc
- control to alter (not null)newState
- true means enable the control, false means disable it
-