com.jme3.input
クラス ChaseCamera

java.lang.Object
  上位を拡張 com.jme3.input.ChaseCamera
すべての実装されたインタフェース:
Savable, ActionListener, AnalogListener, InputListener, Control

public class ChaseCamera
extends java.lang.Object
implements ActionListener, AnalogListener, Control

A camera that follows a spatial and can turn around it by dragging the mouse


コンストラクタの概要
ChaseCamera(Camera cam)
          Constructs the chase camera if you use this constructor you have to attach the cam later to a spatial doing spatial.addControl(chaseCamera);
ChaseCamera(Camera cam, InputManager inputManager)
          Constructs the chase camera, and registers inputs if you use this constructor you have to attach the cam later to a spatial doing spatial.addControl(chaseCamera);
ChaseCamera(Camera cam, Spatial target)
          Constructs the chase camera
ChaseCamera(Camera cam, Spatial target, InputManager inputManager)
          Constructs the chase camera, and registers inputs
 
メソッドの概要
 Control cloneForSpatial(Spatial spatial)
          clone this camera for a spatial
 float getChasingSensitivity()
          returns the chasing sensitivity
 float getDistanceToTarget()
          return the current distance from the camera to the target
 float getHorizontalRotation()
          returns the current horizontal rotation around the target in radians
 Vector3f getLookAtOffset()
          returns the offset from the target's position where the camera looks at
 float getMaxDistance()
          Returns the max zoom distance of the camera (default is 40)
 float getMaxVerticalRotation()
          returns the maximal vertical rotation angle of the camera around the target
 float getMinDistance()
          Returns the min zoom distance of the camera (default is 1)
 float getMinVerticalRotation()
          returns the minimal vertical rotation angle of the camera around the target
 float getRotationSensitivity()
          Returns the rotation sensitivity
 float getTrailingRotationInertia()
          returns the trailing rotation inertia
 float getTrailingSensitivity()
          returns the trailing sensitivity
 Vector3f getUpVector()
          Returns the up vector of the camera used for the lookAt on the target
 float getVerticalRotation()
          returns the current vertical rotation around the target in radians.
 float getZoomSensitivity()
          returns the zoom sensitivity
 boolean isDragToRotate()
           
 boolean isEnabled()
          Return the enabled/disabled state of the camera
 boolean isSmoothMotion()
          returns true is smmoth motion is enabled for this chase camera
 boolean isTrailingEnabled()
          returns true if the trailing is enabled
 void onAction(java.lang.String name, boolean keyPressed, float tpf)
          Called when an input to which this listener is registered to is invoked.
 void onAnalog(java.lang.String name, float value, float tpf)
          Called to notify the implementation that an analog event has occurred.
 void read(JmeImporter im)
          Read the camera
 void registerWithInput(InputManager inputManager)
          Registers inputs with the input manager
 void render(RenderManager rm, ViewPort vp)
          renders the camera control, should only be used internally
 void setChasingSensitivity(float chasingSensitivity)
          Sets the chasing sensitivity, the lower the value the slower the camera will follow the target when it moves
 void setDefaultDistance(float defaultDistance)
          Sets the default distance at start of applicaiton
 void setDefaultHorizontalRotation(float angle)
          sets the default horizontal rotation of the camera at start of the application
 void setDefaultVerticalRotation(float angle)
          sets the default vertical rotation of the camera at start of the application
 void setDragToRotate(boolean dragToRotate)
           
 void setEnabled(boolean enabled)
          Enable or disable the camera
 void setInvertHorizontalAxis(boolean invertXaxis)
          invert the Horizontal axis movement of the mouse
 void setInvertVerticalAxis(boolean invertYaxis)
          invert the vertical axis movement of the mouse
 void setLookAtOffset(Vector3f lookAtOffset)
          Sets the offset from the target's position where the camera looks at
 void setMaxDistance(float maxDistance)
          Sets the max zoom distance of the camera (default is 40)
 void setMaxVerticalRotation(float maxVerticalRotation)
          sets the maximal vertical rotation angle of the camera around the target default is Pi/2;
 void setMinDistance(float minDistance)
          Sets the min zoom distance of the camera (default is 1)
 void setMinVerticalRotation(float minHeight)
          sets the minimal vertical rotation angle of the camera around the target default is 0;
 void setRotationSensitivity(float rotationSensitivity)
          Sets the rotation sensitivity, the lower the value the slower the camera will rotates around the target when draging with the mouse default is 5
 void setSmoothMotion(boolean smoothMotion)
          Enables smooth motion for this chase camera
 void setSpatial(Spatial spatial)
          Sets the spacial for the camera control, should only be used internally
 void setToggleRotationTrigger(Trigger... triggers)
          Sets custom triggers for toggleing the rotation of the cam deafult are new MouseButtonTrigger(MouseInput.BUTTON_LEFT) left mouse button new MouseButtonTrigger(MouseInput.BUTTON_RIGHT) right mouse button
 void setTrailingEnabled(boolean trailingEnabled)
          Enable the camera trailing : The camera smoothly go in the targets trail when it moves.
 void setTrailingRotationInertia(float trailingRotationInertia)
          Sets the trailing rotation inertia : default is 0.1.
 void setTrailingSensitivity(float trailingSensitivity)
          Sets the trailing sensitivity, the lower the value, the slower the camera will go in the target trail when it moves.
 void setUpVector(Vector3f up)
          Sets the up vector of the camera used for the lookAt on the target
 void setZoomInTrigger(Trigger... triggers)
          Sets custom triggers for zomming in the cam default is new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true) mouse wheel up
 void setZoomOutTrigger(Trigger... triggers)
          Sets custom triggers for zomming out the cam default is new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false) mouse wheel down
 void setZoomSensitivity(float zoomSensitivity)
          Sets the zoom sensitivity, the lower the value, the slower the camera will zoom in and out.
 void update(float tpf)
          update the camera control, should only be used internally
 void write(JmeExporter ex)
          Write the camera
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ChaseCamera

public ChaseCamera(Camera cam,
                   Spatial target)
Constructs the chase camera

パラメータ:
cam - the application camera
target - the spatial to follow

ChaseCamera

public ChaseCamera(Camera cam)
Constructs the chase camera if you use this constructor you have to attach the cam later to a spatial doing spatial.addControl(chaseCamera);

パラメータ:
cam - the application camera

ChaseCamera

public ChaseCamera(Camera cam,
                   InputManager inputManager)
Constructs the chase camera, and registers inputs if you use this constructor you have to attach the cam later to a spatial doing spatial.addControl(chaseCamera);

パラメータ:
cam - the application camera
inputManager - the inputManager of the application to register inputs

ChaseCamera

public ChaseCamera(Camera cam,
                   Spatial target,
                   InputManager inputManager)
Constructs the chase camera, and registers inputs

パラメータ:
cam - the application camera
target - the spatial to follow
inputManager - the inputManager of the application to register inputs
メソッドの詳細

onAction

public void onAction(java.lang.String name,
                     boolean keyPressed,
                     float tpf)
インタフェース ActionListener の記述:
Called when an input to which this listener is registered to is invoked.

定義:
インタフェース ActionListener 内の onAction
パラメータ:
name - The name of the mapping that was invoked
keyPressed - True if the action is "pressed", false otherwise
tpf - The time per frame value.

onAnalog

public void onAnalog(java.lang.String name,
                     float value,
                     float tpf)
インタフェース AnalogListener の記述:
Called to notify the implementation that an analog event has occurred. The results of KeyTrigger and MouseButtonTrigger events will have tpf == value.

定義:
インタフェース AnalogListener 内の onAnalog
パラメータ:
name - The name of the mapping that was invoked
value - Value of the axis, from 0 to 1.
tpf - The time per frame value.

registerWithInput

public final void registerWithInput(InputManager inputManager)
Registers inputs with the input manager

パラメータ:
inputManager -

setToggleRotationTrigger

public void setToggleRotationTrigger(Trigger... triggers)
Sets custom triggers for toggleing the rotation of the cam deafult are new MouseButtonTrigger(MouseInput.BUTTON_LEFT) left mouse button new MouseButtonTrigger(MouseInput.BUTTON_RIGHT) right mouse button

パラメータ:
triggers -

setZoomInTrigger

public void setZoomInTrigger(Trigger... triggers)
Sets custom triggers for zomming in the cam default is new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true) mouse wheel up

パラメータ:
triggers -

setZoomOutTrigger

public void setZoomOutTrigger(Trigger... triggers)
Sets custom triggers for zomming out the cam default is new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false) mouse wheel down

パラメータ:
triggers -

isEnabled

public boolean isEnabled()
Return the enabled/disabled state of the camera

定義:
インタフェース Control 内の isEnabled
戻り値:
true if the camera is enabled
関連項目:
Control.setEnabled(boolean)

setEnabled

public void setEnabled(boolean enabled)
Enable or disable the camera

定義:
インタフェース Control 内の setEnabled
パラメータ:
enabled - true to enable

getMaxDistance

public float getMaxDistance()
Returns the max zoom distance of the camera (default is 40)

戻り値:
maxDistance

setMaxDistance

public void setMaxDistance(float maxDistance)
Sets the max zoom distance of the camera (default is 40)

パラメータ:
maxDistance -

getMinDistance

public float getMinDistance()
Returns the min zoom distance of the camera (default is 1)

戻り値:
minDistance

setMinDistance

public void setMinDistance(float minDistance)
Sets the min zoom distance of the camera (default is 1)


cloneForSpatial

public Control cloneForSpatial(Spatial spatial)
clone this camera for a spatial

定義:
インタフェース Control 内の cloneForSpatial
パラメータ:
spatial -
戻り値:

setSpatial

public void setSpatial(Spatial spatial)
Sets the spacial for the camera control, should only be used internally

定義:
インタフェース Control 内の setSpatial
パラメータ:
spatial -

update

public void update(float tpf)
update the camera control, should only be used internally

定義:
インタフェース Control 内の update
パラメータ:
tpf -

render

public void render(RenderManager rm,
                   ViewPort vp)
renders the camera control, should only be used internally

定義:
インタフェース Control 内の render
パラメータ:
rm -
vp -

write

public void write(JmeExporter ex)
           throws java.io.IOException
Write the camera

定義:
インタフェース Savable 内の write
パラメータ:
ex - the exporter
例外:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Read the camera

定義:
インタフェース Savable 内の read
パラメータ:
im -
例外:
java.io.IOException

getMaxVerticalRotation

public float getMaxVerticalRotation()
returns the maximal vertical rotation angle of the camera around the target

戻り値:

setMaxVerticalRotation

public void setMaxVerticalRotation(float maxVerticalRotation)
sets the maximal vertical rotation angle of the camera around the target default is Pi/2;

パラメータ:
maxVerticalRotation -

getMinVerticalRotation

public float getMinVerticalRotation()
returns the minimal vertical rotation angle of the camera around the target

戻り値:

setMinVerticalRotation

public void setMinVerticalRotation(float minHeight)
sets the minimal vertical rotation angle of the camera around the target default is 0;

パラメータ:
minHeight -

isSmoothMotion

public boolean isSmoothMotion()
returns true is smmoth motion is enabled for this chase camera

戻り値:

setSmoothMotion

public void setSmoothMotion(boolean smoothMotion)
Enables smooth motion for this chase camera

パラメータ:
smoothMotion -

getChasingSensitivity

public float getChasingSensitivity()
returns the chasing sensitivity

戻り値:

setChasingSensitivity

public void setChasingSensitivity(float chasingSensitivity)
Sets the chasing sensitivity, the lower the value the slower the camera will follow the target when it moves

パラメータ:
chasingSensitivity -

getRotationSensitivity

public float getRotationSensitivity()
Returns the rotation sensitivity

戻り値:

setRotationSensitivity

public void setRotationSensitivity(float rotationSensitivity)
Sets the rotation sensitivity, the lower the value the slower the camera will rotates around the target when draging with the mouse default is 5

パラメータ:
rotationSensitivity -

isTrailingEnabled

public boolean isTrailingEnabled()
returns true if the trailing is enabled

戻り値:

setTrailingEnabled

public void setTrailingEnabled(boolean trailingEnabled)
Enable the camera trailing : The camera smoothly go in the targets trail when it moves.

パラメータ:
trailingEnabled -

getTrailingRotationInertia

public float getTrailingRotationInertia()
returns the trailing rotation inertia

戻り値:

setTrailingRotationInertia

public void setTrailingRotationInertia(float trailingRotationInertia)
Sets the trailing rotation inertia : default is 0.1. This prevent the camera to roughtly stop when the target stops moving before the camera reached the trail position.

パラメータ:
trailingRotationInertia -

getTrailingSensitivity

public float getTrailingSensitivity()
returns the trailing sensitivity

戻り値:

setTrailingSensitivity

public void setTrailingSensitivity(float trailingSensitivity)
Sets the trailing sensitivity, the lower the value, the slower the camera will go in the target trail when it moves. default is 0.5;

パラメータ:
trailingSensitivity -

getZoomSensitivity

public float getZoomSensitivity()
returns the zoom sensitivity

戻り値:

setZoomSensitivity

public void setZoomSensitivity(float zoomSensitivity)
Sets the zoom sensitivity, the lower the value, the slower the camera will zoom in and out. default is 5.

パラメータ:
zoomSensitivity -

setDefaultDistance

public void setDefaultDistance(float defaultDistance)
Sets the default distance at start of applicaiton

パラメータ:
defaultDistance -

setDefaultHorizontalRotation

public void setDefaultHorizontalRotation(float angle)
sets the default horizontal rotation of the camera at start of the application

パラメータ:
angle -

setDefaultVerticalRotation

public void setDefaultVerticalRotation(float angle)
sets the default vertical rotation of the camera at start of the application

パラメータ:
angle -

isDragToRotate

public boolean isDragToRotate()
戻り値:
If drag to rotate feature is enabled.
関連項目:
FlyByCamera.setDragToRotate(boolean)

setDragToRotate

public void setDragToRotate(boolean dragToRotate)
パラメータ:
dragToRotate - When true, the user must hold the mouse button and drag over the screen to rotate the camera, and the cursor is visible until dragged. Otherwise, the cursor is invisible at all times and holding the mouse button is not needed to rotate the camera. This feature is disabled by default.

getDistanceToTarget

public float getDistanceToTarget()
return the current distance from the camera to the target

戻り値:

getHorizontalRotation

public float getHorizontalRotation()
returns the current horizontal rotation around the target in radians

戻り値:

getVerticalRotation

public float getVerticalRotation()
returns the current vertical rotation around the target in radians.

戻り値:

getLookAtOffset

public Vector3f getLookAtOffset()
returns the offset from the target's position where the camera looks at

戻り値:

setLookAtOffset

public void setLookAtOffset(Vector3f lookAtOffset)
Sets the offset from the target's position where the camera looks at

パラメータ:
lookAtOffset -

setUpVector

public void setUpVector(Vector3f up)
Sets the up vector of the camera used for the lookAt on the target

パラメータ:
up -

getUpVector

public Vector3f getUpVector()
Returns the up vector of the camera used for the lookAt on the target

戻り値:

setInvertVerticalAxis

public void setInvertVerticalAxis(boolean invertYaxis)
invert the vertical axis movement of the mouse

パラメータ:
invertYaxis -

setInvertHorizontalAxis

public void setInvertHorizontalAxis(boolean invertXaxis)
invert the Horizontal axis movement of the mouse

パラメータ:
invertYaxis -