| Package | alternativa.engine3d.core |
| Class | public class Object3D |
| Implements | flash.events.IEventDispatcher |
| Subclasses | Camera3D, Mesh, Sprite3D |
The global transformation of an object in the scene coordinate system is a composition of local transformations of the object and all of its parents in the objects' tree.
The class implements flash.events.IEventDispatcher interface and can receive mouse events which contain an information about point in the 3d-space where an event has occured. The capture and bubbling phases are not implemented yet.
| Property | Defined by | ||
|---|---|---|---|
| children : Set
[read-only] A set of child objects.
| Object3D | ||
| coords : Point3D
Object coordinates.
| Object3D | ||
| mobility : int Mobility level.
| Object3D | ||
| mouseEnabled : Boolean = true Specifies whether this object receives mouse messages.
| Object3D | ||
| name : String Object name.
| Object3D | ||
| parent : Object3D
[read-only] Parent object.
| Object3D | ||
| rotationX : Number X-axis rotation angle in radians.
| Object3D | ||
| rotationY : Number Y-axis rotation angle in radians.
| Object3D | ||
| rotationZ : Number Z-axis rotation angle in radians.
| Object3D | ||
| scaleX : Number X-axis scale coefficient.
| Object3D | ||
| scaleY : Number Y-axis scale coefficient.
| Object3D | ||
| scaleZ : Number Z-axis scale coefficient.
| Object3D | ||
| scene : Scene3D
[read-only] Scene containing given object.
| Object3D | ||
| transformation : Matrix3D
[read-only] Full (global) transformation matrix of an object.
| Object3D | ||
| x : Number X coordinate.
| Object3D | ||
| y : Number Y coordinate.
| Object3D | ||
| z : Number Z coordinate.
| Object3D | ||
| Method | Defined by | ||
|---|---|---|---|
|
Object3D(name:String = null)
Create an instance of class.
| Object3D | ||
|
Adds a child object.
| Object3D | ||
|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
| Object3D | ||
|
Clones object.
| Object3D | ||
|
dispatchEvent(event:Event):Boolean
Dispatches an event.
| Object3D | ||
|
forEach(func:Function):void
Calls the specified function for the object an all its children, passing the current object as an argument.
| Object3D | ||
|
getChildByName(name:String, deep:Boolean = false):Object3D
Gets a child object with the given name.
| Object3D | ||
|
Transforms a point form global coordinate system to an object's coordinate system
| Object3D | ||
|
hasEventListener(type:String):Boolean
Checks if there are registered event listeners for events of the specified type.
| Object3D | ||
|
Transforms a point from local coordinate system of an object to global coordinate system.
| Object3D | ||
|
Delete child object.
| Object3D | ||
|
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes an event listener.
| Object3D | ||
|
toString():String
Get string representation of object.
| Object3D | ||
|
willTrigger(type:String):Boolean
| Object3D | ||
| Method | Defined by | ||
|---|---|---|---|
|
addToScene(scene:Scene3D):void
Method is being called when adding object to scene.
| Object3D | ||
|
clonePropertiesFrom(source:Object3D):void
Copy source object properties.
| Object3D | ||
|
Create empty object without inner structure.
| Object3D | ||
|
defaultName():String
Default object name.
| Object3D | ||
|
removeFromScene(scene:Scene3D):void
Method is being called whed deleting object from a scene.
| Object3D | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when a user presses and releases left mouse button over the same object. | Object3D | |||
| Dispatched when a user presses left mouse button over an object. | Object3D | |||
| Dispatched when a user moves mouse pointer while it is over an object. | Object3D | |||
| Dispatched when a user moves mouse pointer away from an object. | Object3D | |||
| Dispatched when a user moves mouse pointer over an object. | Object3D | |||
| Dispatched when a user releases left mouse button over an object. | Object3D | |||
| Dispatched when a user spins mouse wheel over an object. | Object3D | |||
| children | property |
| coords | property |
coords:Point3D [read-write]Object coordinates.
Implementation public function get coords():Point3D
public function set coords(value:Point3D):void
| mobility | property |
mobility:int [read-write]Mobility level. Resulting mobility is a sum of the object mobility and it's parent objects in scene hierarchy.
Implementation public function get mobility():int
public function set mobility(value:int):void
| mouseEnabled | property |
public var mouseEnabled:Boolean = trueSpecifies whether this object receives mouse messages. If an object has this property set to false, no surface or face of the object can recieve mouse messages regardless of their mouseEnabled property.
| name | property |
name:String [read-write]Object name.
Implementation public function get name():String
public function set name(value:String):void
| parent | property |
| rotationX | property |
rotationX:Number [read-write]X-axis rotation angle in radians.
Implementation public function get rotationX():Number
public function set rotationX(value:Number):void
| rotationY | property |
rotationY:Number [read-write]Y-axis rotation angle in radians.
Implementation public function get rotationY():Number
public function set rotationY(value:Number):void
| rotationZ | property |
rotationZ:Number [read-write]Z-axis rotation angle in radians.
Implementation public function get rotationZ():Number
public function set rotationZ(value:Number):void
| scaleX | property |
scaleX:Number [read-write]X-axis scale coefficient.
Implementation public function get scaleX():Number
public function set scaleX(value:Number):void
| scaleY | property |
scaleY:Number [read-write]Y-axis scale coefficient.
Implementation public function get scaleY():Number
public function set scaleY(value:Number):void
| scaleZ | property |
scaleZ:Number [read-write]Z-axis scale coefficient.
Implementation public function get scaleZ():Number
public function set scaleZ(value:Number):void
| scene | property |
scene:Scene3D [read-only]Scene containing given object.
Implementation public function get scene():Scene3D
| transformation | property |
transformation:Matrix3D [read-only]Full (global) transformation matrix of an object.
Implementation public function get transformation():Matrix3D
| x | property |
x:Number [read-write]X coordinate.
Implementation public function get x():Number
public function set x(value:Number):void
| y | property |
y:Number [read-write]Y coordinate.
Implementation public function get y():Number
public function set y(value:Number):void
| z | property |
z:Number [read-write]Z coordinate.
Implementation public function get z():Number
public function set z(value:Number):void
| Object3D | () | constructor |
public function Object3D(name:String = null)Create an instance of class.
Parametersname:String (default = null) — object name |
| addChild | () | method |
public function addChild(child:Object3D):Object3DAdds a child object. Adding object is being deleted from previous parent's list. Parent scene becomes object's new scene.
Parameterschild:Object3D — an object to be added as a child |
Object3D — added object |
Object3DHierarchyError — an attempt to add child object, which cannot be linked with this parent |
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidRegisters an event listener.
Parameterstype:String — the type of an event |
|
listener:Function — the listener function |
|
useCapture:Boolean (default = false) — not used |
|
priority:int (default = 0) — the priority level of the event listener. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. |
|
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak. A strong reference prevents your listener from being garbage-collected. A weak reference does not. |
| addToScene | () | method |
protected function addToScene(scene:Scene3D):voidMethod is being called when adding object to scene. Descendants may redefine method for making specific actions.
Parametersscene:Scene3D — scene, which object is being added to |
| clone | () | method |
public function clone():Object3DClones object. Descendants have to override methods createEmptyObject() и clonePropertiesFrom() for proper cloning.
Object3D — a clone of the object |
See also
| clonePropertiesFrom | () | method |
protected function clonePropertiesFrom(source:Object3D):voidCopy source object properties. This method is being used in clone() method and must be redefined in it's descendants to get a right object. Every descendant must copy only properties that were added to base class in this exact method. Inherited properties copying is made by calling super.clonePropertiesFrom(source).
Parameterssource:Object3D — object, which properties are being copied |
| createEmptyObject | () | method |
protected function createEmptyObject():Object3DCreate empty object without inner structure. For example, if geometrical primitive, when added, forms a bunch of vertices, faces and surfaces, this method don't create them. This method is being used in clone() and has to be redefined in descendants in order to get the right object.
ReturnsObject3D — a new empty object |
| defaultName | () | method |
protected function defaultName():StringDefault object name.
ReturnsString — default object name |
| dispatchEvent | () | method |
public function dispatchEvent(event:Event):BooleanDispatches an event.
Parametersevent:Event — the event to dispatch |
Boolean — false |
| forEach | () | method |
public function forEach(func:Function):voidCalls the specified function for the object an all its children, passing the current object as an argument.
Parametersfunc:Function — function of type Function(object:Object3D):void |
| getChildByName | () | method |
public function getChildByName(name:String, deep:Boolean = false):Object3DGets a child object with the given name.
Parametersname:String — child object name |
|
deep:Boolean (default = false) — deep search mode flag. When value false is specified, the method performs a search only among the direct children of an object, otherwise full subtree of children objects is processed. |
Object3D — any child object which has the specified name or null if there is no such objects |
| globalToLocal | () | method |
public function globalToLocal(point:Point3D, result:Point3D = null):Point3DTransforms a point form global coordinate system to an object's coordinate system
Parameterspoint:Point3D — a point in global coordinate system |
|
result:Point3D (default = null) — the result will be written into this parameter. If value of null is specified, then a new instance of Point3D will be created. |
Point3D — the transformed point |
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanChecks if there are registered event listeners for events of the specified type.
Parameterstype:String — the type of an event |
Boolean — true if there are listeners of events of the specified type, otherwise false |
| localToGlobal | () | method |
public function localToGlobal(point:Point3D, result:Point3D = null):Point3DTransforms a point from local coordinate system of an object to global coordinate system.
Parameterspoint:Point3D — a point in local coordinate system |
|
result:Point3D (default = null) — the result will be written in this parameter. If value of null is specified, then a new instance of Point3D will be created. |
Point3D — the transformed point or null if the object is not in a scene |
| removeChild | () | method |
public function removeChild(child:Object3D):Object3DDelete child object.
Parameterschild:Object3D — child object |
Object3D — removed object |
Object3DNotFoundError — an attempt to delete non-existing object |
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidRemoves an event listener.
Parameterstype:String — the type of an event |
|
listener:Function — the listener function |
|
useCapture:Boolean (default = false) — not used |
| removeFromScene | () | method |
protected function removeFromScene(scene:Scene3D):voidMethod is being called whed deleting object from a scene.Descendants may redefine method for making specific actions.
Parametersscene:Scene3D — scena, from which the object is being deleted from |
| toString | () | method |
public function toString():StringGet string representation of object.
ReturnsString — a string representation of the object |
| willTrigger | () | method |
public function willTrigger(type:String):BooleanParameters
type:String |
Boolean |
| click | event |
alternativa.engine3d.events.MouseEvent3D
alternativa.engine3d.events.MouseEvent3D.CLICK
Dispatched when a user presses and releases left mouse button over the same object.
The value of thetype property of a click event object.| mouseDown | event |
alternativa.engine3d.events.MouseEvent3D
alternativa.engine3d.events.MouseEvent3D.MOUSE_DOWN
Dispatched when a user presses left mouse button over an object.
The value of thetype property of a mouseDown event object.| mouseMove | event |
alternativa.engine3d.events.MouseEvent3D
alternativa.engine3d.events.MouseEvent3D.MOUSE_MOVE
Dispatched when a user moves mouse pointer while it is over an object.
The value of thetype property of a mouseMove event object.| mouseOut | event |
alternativa.engine3d.events.MouseEvent3D
alternativa.engine3d.events.MouseEvent3D.MOUSE_OUT
Dispatched when a user moves mouse pointer away from an object.
The value of thetype property of a mouseOut event object.| mouseOver | event |
alternativa.engine3d.events.MouseEvent3D
alternativa.engine3d.events.MouseEvent3D.MOUSE_OVER
Dispatched when a user moves mouse pointer over an object.
The value of thetype property of a mouseOver event object.| mouseUp | event |
alternativa.engine3d.events.MouseEvent3D
alternativa.engine3d.events.MouseEvent3D.MOUSE_UP
Dispatched when a user releases left mouse button over an object.
The value of thetype property of a mouseUp event object.| mouseWheel | event |
alternativa.engine3d.events.MouseEvent3D
alternativa.engine3d.events.MouseEvent3D.MOUSE_WHEEL
Dispatched when a user spins mouse wheel over an object.
The value of thetype property of a mouseWheel event object.