| Package | alternativa.engine3d.controllers |
| Class | public class ObjectController |
| Subclasses | FlyController, WalkController |
| Property | Defined by | ||
|---|---|---|---|
| accelerated : Boolean [read-only] The accelerated speed mode flag.
| ObjectController | ||
| checkCollisions : Boolean Enabling and disabling collision detection mode.
| ObjectController | ||
| collider : EllipsoidCollider
[read-only] EllipsoidCollider object.
| ObjectController | ||
| coords : Point3D
Coordinates of the controller.
| ObjectController | ||
| enabled : Boolean Enabling and disabling controller.
| ObjectController | ||
| keyboardEnabled : Boolean Enabling and disabling processing of keyboard events.
| ObjectController | ||
| mouseEnabled : Boolean Enabling and disabling processing of mouse events.
| ObjectController | ||
| mouseSensitivity : Number Mouse sensitivity — multiplication coefficient of
mouseSensitivityX and mouseSensitivityY. | ObjectController | ||
| mouseSensitivityX : Number Horizontal mouse sensitivity.
| ObjectController | ||
| mouseSensitivityY : Number Vertical mouse sensitivity.
| ObjectController | ||
| object : Object3D
Controlled object.
| ObjectController | ||
| onStartMoving : Function Function defined as
function():void, which is called when the controlled object starts to move. | ObjectController | ||
| onStopMoving : Function Function defined as
function():void, which is called when the controlled object stops moving. | ObjectController | ||
| pitchSpeed : Number Pitch angular speed (radians per second).
| ObjectController | ||
| speed : Number Speed of the controlled object in units per second.
| ObjectController | ||
| speedMultiplier : Number Speed multiplier on acceleration.
| ObjectController | ||
| yawSpeed : Number Yaw angular speed (radians per second).
| ObjectController | ||
| Property | Defined by | ||
|---|---|---|---|
| _accelerate : Boolean Accelerated mode flag.
| ObjectController | ||
| actionBindings : Map
Map which binds actions' names and actions' handlers.
| ObjectController | ||
| _back : Boolean Back movement flag.
| ObjectController | ||
| _collider : EllipsoidCollider
EllipsoidCollider for collision detection.
| ObjectController | ||
| _coords : Point3D
Controller's current coordinates.
| ObjectController | ||
| _down : Boolean Down movement flag.
| ObjectController | ||
| _enabled : Boolean = true Controller's activity flag.
| ObjectController | ||
| _eventsSource : DisplayObject Keyboard and mouse events' source.
| ObjectController | ||
| _forward : Boolean Forward movement flag.
| ObjectController | ||
| _isMoving : Boolean The flag shows if the controlled object moved in the current frame.
| ObjectController | ||
| keyBindings : Map
Map which binds key codes with actions' names.
| ObjectController | ||
| _keyboardEnabled : Boolean The flag shows if keyboard is enabled.
| ObjectController | ||
| lastFrameTime : uint The time that passed since the last call of the
processInput() method. | ObjectController | ||
| _left : Boolean Left movement flag.
| ObjectController | ||
| _mouseCoefficientX : Number Resulting horizontal mouse sensitivity.
| ObjectController | ||
| _mouseCoefficientY : Number Resulting vertical mouse sensitivity.
| ObjectController | ||
| _mouseEnabled : Boolean Mouse activity flag.
| ObjectController | ||
| _mouseLookActive : Boolean Mouse look mode activity flag.
| ObjectController | ||
| _mouseSensitivity : Number = 1 Mouse sensitivity — multiplication coefficient for horizontal and vertical sensitivities.
| ObjectController | ||
| _mouseSensitivityX : Number Horizontal mouse sensitivity.
| ObjectController | ||
| _mouseSensitivityY : Number Vertical mouse sensitivity.
| ObjectController | ||
| _object : Object3D
Controlled object.
| ObjectController | ||
| _pitchDown : Boolean pitch down flag
| ObjectController | ||
| _pitchSpeed : Number = 1 Angular speed of revolution around pitch axis.
| ObjectController | ||
| _pitchUp : Boolean Pitch up flag.
| ObjectController | ||
| _right : Boolean Right movement flag.
| ObjectController | ||
| _speed : Number = 100 Speed of controller.
| ObjectController | ||
| _speedMultiplier : Number = 2 Speed multiplication coefficient in accelerated mode.
| ObjectController | ||
| startMouseCoords : Point3D
Starting coordinates of the mouse cursor in mouse look mode.
| ObjectController | ||
| _up : Boolean Up movement flag.
| ObjectController | ||
| _yawLeft : Boolean Yaw left flag.
| ObjectController | ||
| _yawRight : Boolean Yaw right flag.
| ObjectController | ||
| _yawSpeed : Number = 1 Angular speed of revolution around yaw axis.
| ObjectController | ||
| Method | Defined by | ||
|---|---|---|---|
|
ObjectController(eventsSourceObject:DisplayObject)
Creates a new instance of controller.
| ObjectController | ||
|
accelerate(value:Boolean):void
Activation of accelerated speed mode.
| ObjectController | ||
|
bindKey(keyCode:uint, action:String):void
The method binds a key to an action.
| ObjectController | ||
|
moveBack(value:Boolean):void
Activation of back movement.
| ObjectController | ||
|
moveDown(value:Boolean):void
Activation of down movement.
| ObjectController | ||
|
moveForward(value:Boolean):void
Activation of forward movement.
| ObjectController | ||
|
moveLeft(value:Boolean):void
Activation of left movement.
| ObjectController | ||
|
moveRight(value:Boolean):void
Activation of right movement.
| ObjectController | ||
|
moveUp(value:Boolean):void
Activation of up movement.
| ObjectController | ||
|
pitchDown(value:Boolean):void
Activation of pitching down.
| ObjectController | ||
|
pitchUp(value:Boolean):void
Activation of pitching up.
| ObjectController | ||
|
processInput():void
The method processes all control influences.
| ObjectController | ||
|
readCoords(point:Point3D):void
The method stores controller's coordinates in the given variable.
| ObjectController | ||
|
setDefaultBindings():void
The method sets default keys' bindings.
| ObjectController | ||
|
setMouseLook(value:Boolean):void
The method enables and disables mouse look mode.
| ObjectController | ||
|
unbindAll():void
Clear all key bindings.
| ObjectController | ||
|
unbindKey(keyCode:uint):void
Clear key binding.
| ObjectController | ||
|
yawLeft(value:Boolean):void
Activation of yawing left.
| ObjectController | ||
|
yawRight(value:Boolean):void
Activation of yawing right.
| ObjectController | ||
| Method | Defined by | ||
|---|---|---|---|
|
applyDisplacement(frameTime:Number, displacement:Point3D):void
The method applies displacement to the controlled object.
| ObjectController | ||
|
clearCommandFlags():void
The method resets active commands' flags.
| ObjectController | ||
|
getDisplacement(frameTime:Number, displacement:Point3D):void
The method calculates potential displacement during the current frame.
| ObjectController | ||
|
registerKeyboardListeners():void
The method registers necessary keyboard listeners.
| ObjectController | ||
|
registerMouseListeners():void
The method registers necessary mouse listeners.
| ObjectController | ||
|
rotateObject(frameTime:Number):void
The method rotates the controlled object according to control influences.
| ObjectController | ||
|
setObjectCoords():void
The method sets coordinates of the controlled object depending on the controller's coordinates.
| ObjectController | ||
|
startMouseLook():void
The method performs the necessary actions when mouse look mode is activated.
| ObjectController | ||
|
stopMouseLook():void
The method performs the necessary actions when mouse look mode is deactivated.
| ObjectController | ||
|
unregisterKeyboardListeners():void
The method removes keyboard listeners when keyboard is deactivated.
| ObjectController | ||
|
unregisterMouseListeners():void
The method removes mouse listeners when mouse is deactivated.
| ObjectController | ||
| Constant | Defined by | ||
|---|---|---|---|
| ACTION_ACCELERATE : String = "ACTION_ACCELERATE" [static] Action name for binding ACCELERATE button.
| ObjectController | ||
| ACTION_BACK : String = "ACTION_BACK" [static] Action name for binding BACK movement button.
| ObjectController | ||
| ACTION_DOWN : String = "ACTION_DOWN" [static] Action name for binding DOWN movement button.
| ObjectController | ||
| ACTION_FORWARD : String = "ACTION_FORWARD" [static] Action name for binding FORWARD movement button.
| ObjectController | ||
| ACTION_LEFT : String = "ACTION_LEFT" [static] Action name for binding LEFT movement button.
| ObjectController | ||
| ACTION_MOUSE_LOOK : String = "ACTION_MOUSE_LOOK" [static] Action name for binding MOUSE_LOOK button.
| ObjectController | ||
| ACTION_PITCH_DOWN : String = "ACTION_PITCH_DOWN" [static] Action name for binding PITCH_DOWN button.
| ObjectController | ||
| ACTION_PITCH_UP : String = "ACTION_PITCH_UP" [static] Action name for binding PITCH_UP button.
| ObjectController | ||
| ACTION_RIGHT : String = "ACTION_RIGHT" [static] Action name for binding RIGHT movement button.
| ObjectController | ||
| ACTION_UP : String = "ACTION_UP" [static] Action name for binding UP movement button.
| ObjectController | ||
| ACTION_YAW_LEFT : String = "ACTION_YAW_LEFT" [static] Action name for binding YAW_LEFT button.
| ObjectController | ||
| ACTION_YAW_RIGHT : String = "ACTION_YAW_RIGHT" [static] Action name for binding YAW_RIGHT button.
| ObjectController | ||
| _accelerate | property |
protected var _accelerate:BooleanAccelerated mode flag.
| accelerated | property |
accelerated:Boolean [read-only]The accelerated speed mode flag.
Implementation public function get accelerated():Boolean
| actionBindings | property |
protected var actionBindings:MapMap which binds actions' names and actions' handlers. Handlers must be declared as function(value:Boolean):void. The parameter value shows if the corresponding action key is pressed.
| _back | property |
protected var _back:BooleanBack movement flag.
| checkCollisions | property |
public var checkCollisions:BooleanEnabling and disabling collision detection mode.
| _collider | property |
protected var _collider:EllipsoidColliderEllipsoidCollider for collision detection.
| collider | property |
collider:EllipsoidCollider [read-only]EllipsoidCollider object.
Implementation public function get collider():EllipsoidCollider
| _coords | property |
protected var _coords:Point3DController's current coordinates.
| coords | property |
coords:Point3D [read-write]Coordinates of the controller. These coordinates match ellipsoid's center coordinates which is used for collision detection. Coordinates of the controlled object may not match coordinates of the controller.
Implementation public function get coords():Point3D
public function set coords(value:Point3D):void
See also
| _down | property |
protected var _down:BooleanDown movement flag.
| _enabled | property |
protected var _enabled:Boolean = trueController's activity flag.
| enabled | property |
enabled:Boolean [read-write]Enabling and disabling controller. Disabled controller skips processInput() method.
The default value is true.
public function get enabled():Boolean
public function set enabled(value:Boolean):void
See also
| _eventsSource | property |
protected var _eventsSource:DisplayObjectKeyboard and mouse events' source.
| _forward | property |
protected var _forward:BooleanForward movement flag.
| _isMoving | property |
protected var _isMoving:BooleanThe flag shows if the controlled object moved in the current frame.
| keyBindings | property |
protected var keyBindings:MapMap which binds key codes with actions' names.
| _keyboardEnabled | property |
protected var _keyboardEnabled:BooleanThe flag shows if keyboard is enabled.
| keyboardEnabled | property |
keyboardEnabled:Boolean [read-write]Enabling and disabling processing of keyboard events. On enabling the registerKeyboardListeners method is called, on disabling — unregisterKeyboardListeners.
public function get keyboardEnabled():Boolean
public function set keyboardEnabled(value:Boolean):void
See also
| lastFrameTime | property |
protected var lastFrameTime:uintThe time that passed since the last call of the processInput() method.
| _left | property |
protected var _left:BooleanLeft movement flag.
| _mouseCoefficientX | property |
protected var _mouseCoefficientX:NumberResulting horizontal mouse sensitivity.
| _mouseCoefficientY | property |
protected var _mouseCoefficientY:NumberResulting vertical mouse sensitivity.
| _mouseEnabled | property |
protected var _mouseEnabled:BooleanMouse activity flag.
| mouseEnabled | property |
mouseEnabled:Boolean [read-write]Enabling and disabling processing of mouse events. On enabling the registerMouseListeners method is called, on disabling — unregisterMouseListeners.
public function get mouseEnabled():Boolean
public function set mouseEnabled(value:Boolean):void
See also
| _mouseLookActive | property |
protected var _mouseLookActive:BooleanMouse look mode activity flag.
| _mouseSensitivity | property |
protected var _mouseSensitivity:Number = 1Mouse sensitivity — multiplication coefficient for horizontal and vertical sensitivities.
| mouseSensitivity | property |
mouseSensitivity:Number [read-write]Mouse sensitivity — multiplication coefficient of mouseSensitivityX and mouseSensitivityY.
The default value is 1.
public function get mouseSensitivity():Number
public function set mouseSensitivity(value:Number):void
See also
| _mouseSensitivityX | property |
protected var _mouseSensitivityX:NumberHorizontal mouse sensitivity.
| mouseSensitivityX | property |
mouseSensitivityX:Number [read-write]Horizontal mouse sensitivity.
The default value is Math.PI / 360.
public function get mouseSensitivityX():Number
public function set mouseSensitivityX(value:Number):void
See also
| _mouseSensitivityY | property |
protected var _mouseSensitivityY:NumberVertical mouse sensitivity.
| mouseSensitivityY | property |
mouseSensitivityY:Number [read-write]Vertical mouse sensitivity.
The default value is Math.PI / 360.
public function get mouseSensitivityY():Number
public function set mouseSensitivityY(value:Number):void
See also
| _object | property |
protected var _object:Object3DControlled object.
| object | property |
object:Object3D [read-write]Controlled object.
Implementation public function get object():Object3D
public function set object(value:Object3D):void
| onStartMoving | property |
public var onStartMoving:FunctionFunction defined as function():void, which is called when the controlled object starts to move.
| onStopMoving | property |
public var onStopMoving:FunctionFunction defined as function():void, which is called when the controlled object stops moving.
| _pitchDown | property |
protected var _pitchDown:Booleanpitch down flag
| _pitchSpeed | property |
protected var _pitchSpeed:Number = 1Angular speed of revolution around pitch axis.
| pitchSpeed | property |
pitchSpeed:Number [read-write]Pitch angular speed (radians per second).
The default value is 1.
public function get pitchSpeed():Number
public function set pitchSpeed(value:Number):void
| _pitchUp | property |
protected var _pitchUp:BooleanPitch up flag.
| _right | property |
protected var _right:BooleanRight movement flag.
| _speed | property |
protected var _speed:Number = 100Speed of controller.
| speed | property |
speed:Number [read-write]Speed of the controlled object in units per second. If a negative value is passed, the absolute value is used.
The default value is 100.
public function get speed():Number
public function set speed(value:Number):void
| _speedMultiplier | property |
protected var _speedMultiplier:Number = 2Speed multiplication coefficient in accelerated mode.
| speedMultiplier | property |
speedMultiplier:Number [read-write]Speed multiplier on acceleration.
The default value is 2.
public function get speedMultiplier():Number
public function set speedMultiplier(value:Number):void
| startMouseCoords | property |
protected var startMouseCoords:Point3DStarting coordinates of the mouse cursor in mouse look mode.
| _up | property |
protected var _up:BooleanUp movement flag.
| _yawLeft | property |
protected var _yawLeft:BooleanYaw left flag.
| _yawRight | property |
protected var _yawRight:BooleanYaw right flag.
| _yawSpeed | property |
protected var _yawSpeed:Number = 1Angular speed of revolution around yaw axis.
| yawSpeed | property |
yawSpeed:Number [read-write]Yaw angular speed (radians per second).
The default value is 1.
public function get yawSpeed():Number
public function set yawSpeed(value:Number):void
| ObjectController | () | constructor |
public function ObjectController(eventsSourceObject:DisplayObject)Creates a new instance of controller.
ParameterseventsSourceObject:DisplayObject — Mouse and keyboard events' source. |
ArgumentError — throws if eventsSourceObject is null |
| accelerate | () | method |
public function accelerate(value:Boolean):voidActivation of accelerated speed mode.
Parametersvalue:Boolean — true to turn on accelerated mode, false to turn it off |
| applyDisplacement | () | method |
protected function applyDisplacement(frameTime:Number, displacement:Point3D):voidThe method applies displacement to the controlled object. Default implementation does nothing.
ParametersframeTime:Number — frame length given in seconds |
|
displacement:Point3D — the displacement to apply |
| bindKey | () | method |
public function bindKey(keyCode:uint, action:String):voidThe method binds a key to an action. One key can have only one action assigned.
ParameterskeyCode:uint — key code |
|
action:String — action name |
See also
| clearCommandFlags | () | method |
protected function clearCommandFlags():voidThe method resets active commands' flags.
| getDisplacement | () | method |
protected function getDisplacement(frameTime:Number, displacement:Point3D):voidThe method calculates potential displacement during the current frame. Default implementation does nothing.
ParametersframeTime:Number — frame length given in seconds |
|
displacement:Point3D — calculated displacement is stored in this parameter |
| moveBack | () | method |
public function moveBack(value:Boolean):voidActivation of back movement.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| moveDown | () | method |
public function moveDown(value:Boolean):voidActivation of down movement.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| moveForward | () | method |
public function moveForward(value:Boolean):voidActivation of forward movement.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| moveLeft | () | method |
public function moveLeft(value:Boolean):voidActivation of left movement.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| moveRight | () | method |
public function moveRight(value:Boolean):voidActivation of right movement.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| moveUp | () | method |
public function moveUp(value:Boolean):voidActivation of up movement.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| pitchDown | () | method |
public function pitchDown(value:Boolean):voidActivation of pitching down.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| pitchUp | () | method |
public function pitchUp(value:Boolean):voidActivation of pitching up.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| processInput | () | method |
public function processInput():voidThe method processes all control influences. If controlled object is not set or enabled property equals to false than the method is skipped.
The method implemets the following algorithm:
rotateObject() method is called;
getDisplacement() method is called;
applyDisplacement() method is called;
| readCoords | () | method |
public function readCoords(point:Point3D):voidThe method stores controller's coordinates in the given variable.
Parameterspoint:Point3D — a variable to store controller's coordinates |
| registerKeyboardListeners | () | method |
protected function registerKeyboardListeners():voidThe method registers necessary keyboard listeners.
See also
| registerMouseListeners | () | method |
protected function registerMouseListeners():voidThe method registers necessary mouse listeners.
See also
| rotateObject | () | method |
protected function rotateObject(frameTime:Number):voidThe method rotates the controlled object according to control influences. Default implementation does nothing.
ParametersframeTime:Number — frame length given in seconds |
| setDefaultBindings | () | method |
public function setDefaultBindings():voidThe method sets default keys' bindings. The default implementation does nothing.
See also
| setMouseLook | () | method |
public function setMouseLook(value:Boolean):voidThe method enables and disables mouse look mode. When mouse look mode is activated, the startMouseLook() method is called. When mouse look mode is deactivated, the stopMouseLook() method is called.
value:Boolean |
See also
| setObjectCoords | () | method |
protected function setObjectCoords():voidThe method sets coordinates of the controlled object depending on the controller's coordinates.
| startMouseLook | () | method |
protected function startMouseLook():voidThe method performs the necessary actions when mouse look mode is activated. The default implementation stores initial global mouse coordinates in the startMouseCoords variable.
See also
| stopMouseLook | () | method |
protected function stopMouseLook():voidThe method performs the necessary actions when mouse look mode is deactivated. The default implementation does nothing.
See also
| unbindAll | () | method |
| unbindKey | () | method |
public function unbindKey(keyCode:uint):voidClear key binding.
ParameterskeyCode:uint — key code |
See also
| unregisterKeyboardListeners | () | method |
protected function unregisterKeyboardListeners():voidThe method removes keyboard listeners when keyboard is deactivated.
See also
| unregisterMouseListeners | () | method |
protected function unregisterMouseListeners():voidThe method removes mouse listeners when mouse is deactivated.
See also
| yawLeft | () | method |
public function yawLeft(value:Boolean):voidActivation of yawing left.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| yawRight | () | method |
public function yawRight(value:Boolean):voidActivation of yawing right.
Parametersvalue:Boolean — true to start movement, false to stop movement |
| ACTION_ACCELERATE | constant |
public static const ACTION_ACCELERATE:String = "ACTION_ACCELERATE"Action name for binding ACCELERATE button.
| ACTION_BACK | constant |
public static const ACTION_BACK:String = "ACTION_BACK"Action name for binding BACK movement button.
| ACTION_DOWN | constant |
public static const ACTION_DOWN:String = "ACTION_DOWN"Action name for binding DOWN movement button.
| ACTION_FORWARD | constant |
public static const ACTION_FORWARD:String = "ACTION_FORWARD"Action name for binding FORWARD movement button.
| ACTION_LEFT | constant |
public static const ACTION_LEFT:String = "ACTION_LEFT"Action name for binding LEFT movement button.
| ACTION_MOUSE_LOOK | constant |
public static const ACTION_MOUSE_LOOK:String = "ACTION_MOUSE_LOOK"Action name for binding MOUSE_LOOK button.
| ACTION_PITCH_DOWN | constant |
public static const ACTION_PITCH_DOWN:String = "ACTION_PITCH_DOWN"Action name for binding PITCH_DOWN button.
| ACTION_PITCH_UP | constant |
public static const ACTION_PITCH_UP:String = "ACTION_PITCH_UP"Action name for binding PITCH_UP button.
| ACTION_RIGHT | constant |
public static const ACTION_RIGHT:String = "ACTION_RIGHT"Action name for binding RIGHT movement button.
| ACTION_UP | constant |
public static const ACTION_UP:String = "ACTION_UP"Action name for binding UP movement button.
| ACTION_YAW_LEFT | constant |
public static const ACTION_YAW_LEFT:String = "ACTION_YAW_LEFT"Action name for binding YAW_LEFT button.
| ACTION_YAW_RIGHT | constant |
public static const ACTION_YAW_RIGHT:String = "ACTION_YAW_RIGHT"Action name for binding YAW_RIGHT button.