Represents the "sun" - the default directional light in the scene.
The following method will throw UnsupportedOperationException
when called: setParent(NodeParent)
- Sunlight's parent cannot be changed, it is always the scene.
All other functionality in Node is supported. You can access the position and rotation of the sun, assign a collision shape to the sun, or add children to the sun. Disabling the sun turns off the default directional light.
Public Methods
void |
Inherited Methods
void |
addLifecycleListener(Node.LifecycleListener lifecycleListener)
Adds a listener that will be called when node lifecycle events occur.
|
void |
addTransformChangedListener(Node.TransformChangedListener transformChangedListener)
Adds a listener that will be called when the node's transformation changes.
|
void |
callOnHierarchy(Consumer<Node> consumer)
Traverses the hierarchy and call a method on each node (including this node).
|
final boolean | |
Node |
findInHierarchy(Predicate<Node> condition)
Traverses the hierarchy to find the first node (including this node) that meets a condition.
|
final Vector3 |
getBack()
Gets the world-space back vector (+z) of this node.
|
CollisionShape |
getCollisionShape()
Gets the shape to use for collisions with this node.
|
final Vector3 |
getDown()
Gets the world-space down vector (-y) of this node.
|
final Vector3 |
getForward()
Gets the world-space forward vector (-z) of this node.
|
final Vector3 |
getLeft()
Gets the world-space left vector (-x) of this node.
|
Light |
getLight()
Gets the current light, which is mutable.
|
final Vector3 |
getLocalPosition()
Gets a copy of the nodes position relative to its parent (local-space).
|
final Quaternion |
getLocalRotation()
Gets a copy of the nodes rotation relative to its parent (local-space).
|
final Vector3 |
getLocalScale()
Gets a copy of the nodes scale relative to its parent (local-space).
|
final String |
getName()
Returns the name of the node.
|
final Node |
getParent()
Returns the parent of this node.
|
Renderable |
getRenderable()
Gets the renderable to display for this node.
|
final Vector3 |
getRight()
Gets the world-space right vector (+x) of this node.
|
final Scene |
getScene()
Returns the scene that this node is part of, null if it isn't part of any scene.
|
final Vector3 |
getUp()
Gets the world-space up vector (+y) of this node.
|
final Vector3 |
getWorldPosition()
Get a copy of the nodes world-space position.
|
final Quaternion |
getWorldRotation()
Gets a copy of the nodes world-space rotation.
|
final Vector3 |
getWorldScale()
Gets a copy of the nodes world-space scale.
|
final boolean |
isActive()
Returns true if the node is active.
|
final boolean |
isDescendantOf(NodeParent ancestor)
Checks whether the given node parent is an ancestor of this node recursively.
|
final boolean |
isEnabled()
Gets the enabled state of this node.
|
boolean |
isTopLevel()
Returns true if this node is top level.
|
final Vector3 |
localToWorldDirection(Vector3 direction)
Converts a direction from the local-space of this node to world-space.
|
final Vector3 | |
void |
onActivate()
Handles when this node becomes active.
|
final void |
onAddChild(Node child)
|
void |
onDeactivate()
Handles when this node becomes inactivate.
|
final void |
onRemoveChild(Node child)
|
boolean |
onTouchEvent(HitTestResult hitTestResult, MotionEvent motionEvent)
Handles when this node is touched.
|
void | |
void | |
void |
removeLifecycleListener(Node.LifecycleListener lifecycleListener)
Removes a listener that will be called when node lifecycle events occur.
|
void |
removeTransformChangedListener(Node.TransformChangedListener transformChangedListener)
Removes a listener that will be called when the node's transformation changes.
|
void |
setCollisionShape(CollisionShape collisionShape)
Sets the shape to used to detect collisions for this
Node . |
final void |
setEnabled(boolean enabled)
Sets the enabled state of this node.
|
void | |
void |
setLocalPosition(Vector3 position)
Sets the position of this node relative to its parent (local-space).
|
void |
setLocalRotation(Quaternion rotation)
Sets the rotation of this node relative to its parent (local-space).
|
void | |
final void |
setLookDirection(Vector3 lookDirection)
Sets the direction that the node is looking at in world-space.
|
final void |
setLookDirection(Vector3 lookDirection, Vector3 upDirection)
Sets the direction that the node is looking at in world-space.
|
final void | |
void |
setOnTapListener(Node.OnTapListener onTapListener)
Registers a callback to be invoked when this node is tapped.
|
void |
setOnTouchListener(Node.OnTouchListener onTouchListener)
Registers a callback to be invoked when a touch event is dispatched to this node.
|
void | |
void | |
void | |
void | |
void | |
String |
toString()
|
final Vector3 |
worldToLocalDirection(Vector3 direction)
Converts a direction from world-space to the local-space of this node.
|
final Vector3 |
final void | |
void | |
boolean | |
Node | |
Node |
findInHierarchy(Predicate<Node> condition)
Traverse the hierarchy to find the first node that meets a condition.
|
final List<Node> |
getChildren()
Returns an immutable list of this parent's children.
|
void |
onAddChild(Node child)
|
void |
onRemoveChild(Node child)
|
final void |
Public Methods
public void setParent (NodeParent parent)
Changes the parent node of this node. If set to null, this node will be detached from its parent. The local position, rotation, and scale of this node will remain the same. Therefore, the world position, rotation, and scale of this node may be different after the parent changes.
The parent may be another Node
or a Scene
. If it is a scene, then this
Node
is considered top level. getParent()
will return null, and getScene()
will return the scene.
Parameters
parent | The new parent that this node will be a child of. If null, this node will be detached from its parent. |
---|