Skip to content
Alessandro Febretti edited this page Aug 2, 2015 · 14 revisions

Last revision: cyclops ver. 1.7 - 1 August 2015

module cyclops extends SceneNode wraps cyclops::Entity

An entity is a drawable thing that derives from a scene node. Entities offer additional functionality for 3d model visualization, like transparency, rendering effects and link to motion capture tracked objects. Upon creation, entities are attached to the scene root, but they can be attached to different nodes in the scene after creation.

Methods

Method(s) Description
Visual Properties
bool isCullingActive(), setCullingActive(bool value) Enables or disables frustum culling for this entity. If culling is enabled (the default state), this entity will be culled when its bounding box does not intersect the camera frustum.
bool hasEffect() Returns true if an effect is set for the entity
Material getMaterial(), Material getMaterialByIndex(int index) Retrieves a Material layer for this entity. getMaterial() returns material layer 0 by default
int getMaterialCount() Returns the number of materials for this entity.
clearMaterials() Removes all the materials for this entity.
addMaterial(Material m) Adds a Material to this entity. The Entity visuals will be automatically updated.
removeMaterial(Material m) Removes a Material from this entity.
setEffect(string effectDefinition) Sets the rendering effect for the entity
setLayer(SceneLayer layer), SceneLayer getLayer() Gets or sets thsi entity layer. See SceneLayer.
Entity Pieces Entities can be made up by multiple components (pieces). For instance, complex loaded models may have multiple parts that we want to manipulate separately.
(string list) listPieces(string path) Returns a list containing the names of all the entity pieces in the specified path. A path is a list of node names in the entity node tree. Use an empy string to list all the piece names connected directly to the entity root.
SceneNode getPiece(string path) Returns a SceneNode for a piece identified by the passed path. If no piece exists for path, returns None. All basic SceneNode functions work on entity pieces, but pieces can't be detached from this entity and attached to another one (doing so will not influence their transform, since it is always local to the owner entity).
Physics
RigidBody getRigidBody() Returns the RigidBody object used to control the physical properties of this entity.
Intersection
setPointIntersectionEnabled(bool value), bool isPointIntersectionEnabled() Enables or disables point-mode ray hit computation for this entity. When enabled, ray intersections with this entity will be computed based on its vertices, instead of its faces. See hitNode.

Examples

Entity Pieces

	# Assume the house model represents a house with a door and window. The window has two panels (left and right)
	house = StaticObject.create('house')
	
	# Print the names of all root pieces for this entity (would print something like 'window, door')
	for pieceName in house.listPieces(''): print pieceName
	
	# Print the names for all pieces under the 'window' piece (would print something like 'left, right')
	for pieceName in house.listPieces('window'): print pieceName
	
	# Get the left window panel and rotate it to open the window.
	leftPanel = house.getPiece('window/left')
	leftPanel.yaw(radians(90))
Clone this wiki locally