Class KX_CameraActuator (2.48)


Methods
getHeight setHeight
getMax setMax
getMin setMin
getObject setObject
getXY setXY
 
Variables
---------- ----------
 
Constants
---------- ----------

Inherited Methods:  Class SCA_ILogicBrick
getExecutePriority setExecutePriority
getOwner ----------

Inherited Methods:  Class PyObjectPlus
isA ----------

Inherited Methods:  Class Value
getName ----------



Methods



getHeight

getHeight()

Returns the height the camera is set to stay above the target object.

Return type:  float number

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# get camera height
camHeight = actCam.getHeight()

getMax

getMax()

Returns the maximum distance to stay from the target.

Return type:  float number

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# get max camera distance
maxDist = actCam.getMax()

getMin

getMin()

Returns the minimum distance to stay from the target.

Return type:  float number

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# get min camera distance
minDist = actCam.getMin()

getObject

getObject()

Returns the name of the object this actuator is tracking.

Return type:  string

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# get name of the object
name  = actCam.getObject()

getXY

getXY()

Returns the axis this actuator is tracking. 

Return type:   bool
1 = True = X axis
0 = False = Y axis

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# get axis actuator is tracking
axisTracking = actCam.getXY()

setHeight

setHeight(height)

Sets the height to stay above the target

height:
Type:  float number

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# set height
actCam.setHeight(5.0)

# use it
GameLogic.addActiveActuator(actCam, True)

setMax

setMax(distance)

Sets the maximum distance to stay from target.

distance:
Type:  float number.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# set maximum distance
actCam.setMax(9.5)

# use it
GameLogic.addActiveActuator(actCam, True)

setMin

setMin(distance)

Sets the minimum distance to stay from target.

distance:
Type:  float number.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# set min distance
actCam.setMin(1.5)

# use it
GameLogic.addActiveActuator(actCam, True)

setObject

setObject(target)

Sets the object the actuator tracks.

target:
Type:  string or KX_GameObject

Note:
In the camera actuator, an object name must be entered.  It can not be left blank.  You can enter any object name you want (even the camera's own object name). Once an object name has been entered, it can be changed to any object you want.

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get current scene
scene = GameLogic.getCurrentScene()

# get object list
objList = scene.getObjectList()

# get object named Box to use as target
target = objList["OBBox"]

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# set target
actCam.setObject(target)

# use it
GameLogic.addActiveActuator(actCam, True)

setXY

setXY(axis)

Sets the game object axis that the camera follows. 

axis:
Type:   bool
    True or 1 = x-axis
    False or 0 = y-axis

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the actuator attached to the controller named act
actCam = controller.getActuator("act")

# follow game object x-axis
actCam.setXY(True)

# use it
GameLogic.addActiveActuator(actCam, True)



Blender 3D
Game Engine