Package | alternativa.engine3d.controllers |
Class | public class SimpleObjectController |
Inheritance | SimpleObjectController ![]() |
Object3D
. Allow to handle the object with a keyboard and mouse.
See also
Property | Defined By | ||
---|---|---|---|
maxPitch : Number = 1e+22
The maximal slope in the vertical plane in radians. | SimpleObjectController | ||
minPitch : Number = -1e+22
The minimal slope in the vertical plane in radians. | SimpleObjectController | ||
mouseSensitivity : Number
Mouse sensitivity. | SimpleObjectController | ||
object : Object3D
Target of handling. | SimpleObjectController | ||
speed : Number
Speed. | SimpleObjectController | ||
speedMultiplier : Number
Speed multiplier for acceleration mode. | SimpleObjectController |
Property | Defined By | ||
---|---|---|---|
keyBindings : Object
The hash for binding key codes and action names. | SimpleObjectController |
Method | Defined By | ||
---|---|---|---|
SimpleObjectController(eventSource:InteractiveObject, object:Object3D, speed:Number, speedMultiplier:Number = 3, mouseSensitivity:Number = 1)
Creates a SimpleObjectController object. | SimpleObjectController | ||
accelerate(value:Boolean):void
Switches acceleration mode. | SimpleObjectController | ||
bindKey(keyCode:uint, action:String):void
Binds key and action. | SimpleObjectController | ||
bindKeys(bindings:Array):void
Binds keys and actions. | SimpleObjectController | ||
disable():void
Disables the controller. | SimpleObjectController | ||
enable():void
Enables the controler. | SimpleObjectController | ||
lookAt(point:Vector3D):void
Sets direction of Z-axis of handled object to pointed at given place. | SimpleObjectController | ||
lookAtXYZ(x:Number, y:Number, z:Number):void
Sets direction of Z-axis of handled object to pointed at given place. | SimpleObjectController | ||
moveBack(value:Boolean):void
Starts and stops move backward according to true or false was passed. | SimpleObjectController | ||
moveDown(value:Boolean):void
Starts and stops move down according to true or false was passed. | SimpleObjectController | ||
moveForward(value:Boolean):void
Starts and stops move forward according to true or false was passed. | SimpleObjectController | ||
moveLeft(value:Boolean):void
Starts and stops move to left according to true or false was passed. | SimpleObjectController | ||
moveRight(value:Boolean):void
Starts and stops move to right according to true or false was passed. | SimpleObjectController | ||
moveUp(value:Boolean):void
Starts and stops move up according to true or false was passed. | SimpleObjectController | ||
setDefaultBindings():void
Sets default binding. | SimpleObjectController | ||
setObjectPos(pos:Vector3D):void
Sets object at given position. | SimpleObjectController | ||
setObjectPosXYZ(x:Number, y:Number, z:Number):void
Sets object at given position. | SimpleObjectController | ||
startMouseLook():void
Enables mouse look mode. | SimpleObjectController | ||
stopMouseLook():void
Disables mouse look mode. | SimpleObjectController | ||
unbindAll():void
Clear binding of all keys. | SimpleObjectController | ||
unbindKey(keyCode:uint):void
Clear binding for given keyCode. | SimpleObjectController | ||
update():void
Calculates and sets new object position. | SimpleObjectController | ||
updateObjectTransform():void
Refreshes controller state from state of handled object. | SimpleObjectController |
Constant | Defined By | ||
---|---|---|---|
ACTION_ACCELERATE : String = ACTION_ACCELERATE [static]
Name of action for binding "accelerate" action. | SimpleObjectController | ||
ACTION_BACK : String = ACTION_BACK [static]
Name of action for binding "back" action. | SimpleObjectController | ||
ACTION_DOWN : String = ACTION_DOWN [static]
Name of action for binding "down" action. | SimpleObjectController | ||
ACTION_FORWARD : String = ACTION_FORWARD [static]
Name of action for binding "forward" action. | SimpleObjectController | ||
ACTION_LEFT : String = ACTION_LEFT [static]
Name of action for binding "left" action. | SimpleObjectController | ||
ACTION_MOUSE_LOOK : String = ACTION_MOUSE_LOOK [static]
ИName of action for binding "mouse look" action. | SimpleObjectController | ||
ACTION_PITCH_DOWN : String = ACTION_PITCH_DOWN [static]
Name of action for binding "pitch down" action. | SimpleObjectController | ||
ACTION_PITCH_UP : String = ACTION_PITCH_UP [static]
Name of action for binding "pitch up" action. | SimpleObjectController | ||
ACTION_RIGHT : String = ACTION_RIGHT [static]
Name of action for binding "right" action. | SimpleObjectController | ||
ACTION_UP : String = ACTION_UP [static]
Name of action for binding "up" action. | SimpleObjectController | ||
ACTION_YAW_LEFT : String = ACTION_YAW_LEFT [static]
Name of action for binding "yaw left" action. | SimpleObjectController | ||
ACTION_YAW_RIGHT : String = ACTION_YAW_RIGHT [static]
Name of action for binding "yaw right" action. | SimpleObjectController |
keyBindings | property |
protected var keyBindings:Object
The hash for binding key codes and action names.
maxPitch | property |
public var maxPitch:Number = 1e+22
The maximal slope in the vertical plane in radians.
minPitch | property |
public var minPitch:Number = -1e+22
The minimal slope in the vertical plane in radians.
mouseSensitivity | property |
public var mouseSensitivity:Number
Mouse sensitivity.
object | property |
object:Object3D
Target of handling.
public function get object():Object3D
public function set object(value:Object3D):void
speed | property |
public var speed:Number
Speed.
speedMultiplier | property |
public var speedMultiplier:Number
Speed multiplier for acceleration mode.
SimpleObjectController | () | Constructor |
public function SimpleObjectController(eventSource:InteractiveObject, object:Object3D, speed:Number, speedMultiplier:Number = 3, mouseSensitivity:Number = 1)
Creates a SimpleObjectController object.
ParameterseventSource:InteractiveObject — Source for event listening.
| |
object:Object3D — Speed of movement.
| |
speed:Number — Mouse sensitivity, i.e. number of degrees per each pixel of mouse movement.
| |
speedMultiplier:Number (default = 3 )
| |
mouseSensitivity:Number (default = 1 )
|
accelerate | () | method |
public function accelerate(value:Boolean):void
Switches acceleration mode.
Parameters
value:Boolean — true turns acceleration on, false turns off.
|
bindKey | () | method |
public function bindKey(keyCode:uint, action:String):void
Binds key and action. Only one action can be assigned to one key.
Parameters
keyCode:uint — Key code.
| |
action:String — Action name.
|
See also
bindKeys | () | method |
public function bindKeys(bindings:Array):void
Binds keys and actions. Only one action can be assigned to one key.
Parameters
bindings:Array — Array which consists of sequence of couples of key code and action. An example are follows: [ keyCode1, action1, keyCode2, action2 ] .
|
disable | () | method |
public function disable():void
Disables the controller.
enable | () | method |
public function enable():void
Enables the controler.
lookAt | () | method |
public function lookAt(point:Vector3D):void
Sets direction of Z-axis of handled object to pointed at given place. If object is a camera, it will look to this direction.
Parameters
point:Vector3D — Point to look at.
|
lookAtXYZ | () | method |
public function lookAtXYZ(x:Number, y:Number, z:Number):void
Sets direction of Z-axis of handled object to pointed at given place. If object is a camera, it will look to this direction.
Parameters
x:Number — X.
| |
y:Number — Y.
| |
z:Number — Z.
|
moveBack | () | method |
public function moveBack(value:Boolean):void
Starts and stops move backward according to true
or false
was passed.
Parameters
value:Boolean — Action switcher.
|
moveDown | () | method |
public function moveDown(value:Boolean):void
Starts and stops move down according to true
or false
was passed.
Parameters
value:Boolean — Action switcher.
|
moveForward | () | method |
public function moveForward(value:Boolean):void
Starts and stops move forward according to true
or false
was passed.
Parameters
value:Boolean — Action switcher.
|
moveLeft | () | method |
public function moveLeft(value:Boolean):void
Starts and stops move to left according to true
or false
was passed.
Parameters
value:Boolean — Action switcher.
|
moveRight | () | method |
public function moveRight(value:Boolean):void
Starts and stops move to right according to true
or false
was passed.
Parameters
value:Boolean — Action switcher.
|
moveUp | () | method |
public function moveUp(value:Boolean):void
Starts and stops move up according to true
or false
was passed.
Parameters
value:Boolean — Action switcher.
|
setDefaultBindings | () | method |
public function setDefaultBindings():void
Sets default binding.
See also
setObjectPos | () | method |
public function setObjectPos(pos:Vector3D):void
Sets object at given position.
Parameters
pos:Vector3D — The position.
|
setObjectPosXYZ | () | method |
public function setObjectPosXYZ(x:Number, y:Number, z:Number):void
Sets object at given position.
Parameters
x:Number — X.
| |
y:Number — Y.
| |
z:Number — Z.
|
startMouseLook | () | method |
public function startMouseLook():void
Enables mouse look mode.
stopMouseLook | () | method |
public function stopMouseLook():void
Disables mouse look mode.
unbindAll | () | method |
unbindKey | () | method |
public function unbindKey(keyCode:uint):void
Clear binding for given keyCode.
Parameters
keyCode:uint — Key code.
|
See also
update | () | method |
public function update():void
Calculates and sets new object position.
updateObjectTransform | () | method |
public function updateObjectTransform():void
Refreshes controller state from state of handled object. Should be called if object was moved without the controller (i.e. object.x = 100;
).
ACTION_ACCELERATE | Constant |
public static const ACTION_ACCELERATE:String = ACTION_ACCELERATE
Name of action for binding "accelerate" action.
ACTION_BACK | Constant |
public static const ACTION_BACK:String = ACTION_BACK
Name of action for binding "back" action.
ACTION_DOWN | Constant |
public static const ACTION_DOWN:String = ACTION_DOWN
Name of action for binding "down" action.
ACTION_FORWARD | Constant |
public static const ACTION_FORWARD:String = ACTION_FORWARD
Name of action for binding "forward" action.
ACTION_LEFT | Constant |
public static const ACTION_LEFT:String = ACTION_LEFT
Name of action for binding "left" action.
ACTION_MOUSE_LOOK | Constant |
public static const ACTION_MOUSE_LOOK:String = ACTION_MOUSE_LOOK
ИName of action for binding "mouse look" action.
ACTION_PITCH_DOWN | Constant |
public static const ACTION_PITCH_DOWN:String = ACTION_PITCH_DOWN
Name of action for binding "pitch down" action.
ACTION_PITCH_UP | Constant |
public static const ACTION_PITCH_UP:String = ACTION_PITCH_UP
Name of action for binding "pitch up" action.
ACTION_RIGHT | Constant |
public static const ACTION_RIGHT:String = ACTION_RIGHT
Name of action for binding "right" action.
ACTION_UP | Constant |
public static const ACTION_UP:String = ACTION_UP
Name of action for binding "up" action.
ACTION_YAW_LEFT | Constant |
public static const ACTION_YAW_LEFT:String = ACTION_YAW_LEFT
Name of action for binding "yaw left" action.
ACTION_YAW_RIGHT | Constant |
public static const ACTION_YAW_RIGHT:String = ACTION_YAW_RIGHT
Name of action for binding "yaw right" action.