Skip to content
Alessandro Febretti edited this page Feb 24, 2015 · 5 revisions

[[module omega | Python-Reference#module-omega]] wraps [omega::SceneNode](http://omegalib.googlecode.com/svn/refdocs/trunk/html/classomega_1_1_scene_node.html)

Last revision: ver. 5.1 - 10 December 2013

Base class for nodes in the scene graph

Methods

Method(s)

Description

Basic

create(string name) static

Creates a scene node with the specified name.

string getName(), setName(string name)

Gets or sets the node name.

Transformation

setPosition(Vector3 pos), setPosition(float x, float y, float z), Vector3 getPosition()

Gets or sets the node position relative to its parent. The value can be specified as 3 floats or as a 3 object.

translate(Vector3 position, Space space), translate(float x, float y, float z, Space space)

Moves the node by the specified amount, using the reference frame specified in Space (see the Space subsection for details). The amount can be specified as 3 floats or as a 3 object.

setScale(Vector3 pos), setScale(float x, float y, float z), Vector3 getScale()

Gets and sets the node scale. The value can be specified as 3 floats or as a 3 object.

Quaternion getOrientation(), setOrientation(Quaternion orientation)

Gets and sets the node orientation (see ).

rotate(Vector3 axis, float angle, Space space)

Rotates the node around the specified 3 axis by angle radians, using the reference frame specified in Space (see the Space subsection for details).

yaw(float rads), pitch(float rads), roll(float rads)

Applies a yaw, pitch or roll to the node (in radians).

resetOrientation()

Resets the node orientation to identity (i.e. zero) orientation.

lookAt(Vector3 position, Vector3 upvector)

Makes the node face the specified position and orients the node Y axis to correspond to the passed up vector. See 3.

Reference Frame

Vector3 convertLocalToWorldPosition(Vector3 position)

Converts a 3 position from the local node reference frame to the global reference frame.

Vector3 convertWorldToLocalPosition(Vector3 position)

Converts a 3 position from the global reference frame to the local node reference frame.

Quaternion convertLocalToWorldOrientation(Quaternion orientation)

Converts a orientation from the local node reference frame to the global reference frame.

Quaternion convertWorldToLocalOrientation(Quaternion orientation)

Converts a orientation from the global reference frame to the local node reference frame.

Hierarchy

int numChildren()

Gets the number of children of this node.

SceneNode getChildByName(string name)

Finds a child by name.

SceneNode getChildByIndex(int index)

Gets a child by index. Note there is no guarantee the objects will be returned back in the same order they were added. If you need precise ordering, consider adding scene nodes to your own list.

addChild(SceneNode node)

Adds a child to this node.

removeChildByRef(SceneNode node)

Removes a child by reference.

removeChildByName(string name)

Removes a child by its name.

removeChildByIndex(int index)

Removes a child by its index.

SceneNode getParent()

Gets the node parent.

Visibility

bool isVisible(), setVisible(bool value)

Gets or sets the node visibility status. A node visibility does not influence children of the node, but only scene objects attached to the node itself. To change children visibility use setChildrenVisible instead.

setChildrenVisible(bool value)

Recursively sets the visibility of descendants of this node.

Bounding box

bool isBoundingBoxVisible(), setBoundingBoxVisible(bool value)

Vector3 getBoundMinimum(), Vector3 getBoundMaximum()

Gets the bounding box minimum or maximum points (as 3 points).

Vector3 getBoundCenter()

Gets the bounding box center as a 3 point.

float getBoundRadius()

Gets the bounding box radius.

Selection control

bool isSelected(), setSelected(bool value)

isSelectable(), setSelectable(bool value)

Camera

setFacingCamera(Camera camera) Camera getFacingCamera()

Makes the node face the specified (billboard mode). Pass None to disable billboard mode.

bool isFacingCameraFixedY(), setFacingCameraFixedY(bool value)

When set to True, Y axis for nodes facing camera will be fixed to the world Y axis. When set to false, the Y axis will follow the camera Y axis (This is the default mode).

Motion Capture

followTrackable(int trackabeId)

Starts following the motion-captured trackable trackableId.

setFollowOffset(Vector3 offset, Quaternion orientationOffset)

Sets the tracking position and orientation offset applied to this object, with respect to the motion captured trackable. (see 3, ).

unfollow()

Stops following a motion-captured trackable.

User Data

string getTag(), setTag(string tag)

Gets or sets the string tag for the node.

(v5.1) setFlag(uint bit)

Sets a custom flag bit on the node. NOTE: Flags from 1 << 16 to 1 << 31 are reserved for C++ modules.

(v5.1) unsetFlag(uint bit)

Unsets a custom flag bit on the node.

(v5.1) bool isFlagSet(uint bit)

Checks if a custom flag is set on the node.

# Global functions # The following is a list of useful global functions related to scene node management # SceneNode getScene() Returns the root of the scene.

querySceneRay(Vector3 origin, Vector3 dir, callback, [flags]) # Performs a query on the scene using a ray defined by the origin and dir 3 parameters. For each hit node, it invokes a callback function taking the node reference and distance to the origin as parameters.

The function accepts optional flags that control the query: - QueryFlags.QuerySort sorts the result nodes from closest to farthest. - QueryFlags.QueryFirst returns only one result. Multiple flags can be used together, i.e. `querySceneRay(a, b, func, QueryFlags.QuerySort

Clone this wiki locally