forked from bartvdbraak/blender
Updates to GamePython Reference.
Added Actuator documentation.
This commit is contained in:
parent
474ec217ae
commit
976e3a1824
@ -1,8 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# Documentation for BL_ActionActuator
|
# Documentation for BL_ActionActuator
|
||||||
from SCA_ILogicBrick import *
|
from SCA_IActuator import *
|
||||||
|
|
||||||
class BL_ActionActuator(SCA_ILogicBrick):
|
class BL_ActionActuator(SCA_IActuator):
|
||||||
"""
|
"""
|
||||||
Action Actuators apply an action to an actor.
|
Action Actuators apply an action to an actor.
|
||||||
"""
|
"""
|
||||||
|
@ -1,6 +1,34 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
"""
|
"""
|
||||||
Documentation for the GameLogic Module.
|
Documentation for the GameLogic Module.
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
There are only three importable modules in the game engine:
|
||||||
|
- GameLogic
|
||||||
|
- L{GameKeys}
|
||||||
|
- L{Rasterizer}
|
||||||
|
|
||||||
|
All the other modules are accessibly through the methods in GameLogic.
|
||||||
|
|
||||||
|
Examples::
|
||||||
|
# To get a controller:
|
||||||
|
import GameLogic
|
||||||
|
co = GameLogic.getCurrentController()
|
||||||
|
|
||||||
|
# To get the game object associated with this controller:
|
||||||
|
obj = co.getOwner()
|
||||||
|
L{KX_GameObject} and possibly L{KX_Camera} and L{KX_Light} methods are
|
||||||
|
available depending on the type of object::
|
||||||
|
# To get a sensor linked to this controller.
|
||||||
|
# "sensorname" is the name of the sensor as defined in the Blender interface.
|
||||||
|
sens = co.getSensor("sensorname")
|
||||||
|
L{KX_NetworkMessageSensor}, L{KX_RaySensor}, L{KX_TouchSensor}, L{SCA_KeyboardSensor},
|
||||||
|
L{SCA_MouseSensor}, L{SCA_PropertySensor} and L{SCA_RandomSensor} methods are available,
|
||||||
|
depending on the type of sensor::
|
||||||
|
# To get a list of all sensors:
|
||||||
|
sensors = co.B{getSensors}()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Constants
|
Constants
|
||||||
=========
|
=========
|
||||||
@ -9,16 +37,16 @@ Constants
|
|||||||
|
|
||||||
Property Sensor
|
Property Sensor
|
||||||
---------------
|
---------------
|
||||||
Tests that the property sensor is able to perform.
|
Tests that the property sensor is able to perform. See L{SCA_PropertySensor}
|
||||||
- KX_PROPSENSOR_EQUAL: Activate when the property is equal to the sensor value.
|
- KX_PROPSENSOR_EQUAL: Activate when the property is equal to the sensor value.
|
||||||
- KX_PROPSENSOR_NOTEQUAL Activate when the property is not equal to the sensor value.
|
- KX_PROPSENSOR_NOTEQUAL: Activate when the property is not equal to the sensor value.
|
||||||
- KX_PROPSENSOR_INTERVAL Activate when the property is between the specified limits.
|
- KX_PROPSENSOR_INTERVAL: Activate when the property is between the specified limits.
|
||||||
- KX_PROPSENSOR_CHANGED Activate when the property changes
|
- KX_PROPSENSOR_CHANGED: Activate when the property changes
|
||||||
- KX_PROPSENSOR_EXPRESSION Activate when the expression matches
|
- KX_PROPSENSOR_EXPRESSION: Activate when the expression matches
|
||||||
|
|
||||||
Constraint Actuator
|
Constraint Actuator
|
||||||
-------------------
|
-------------------
|
||||||
The axis and type (location/rotation) of constraint
|
The axis and type (location/rotation) of constraint. See L{KX_ConstraintActuator}
|
||||||
- KX_CONSTRAINTACT_LOCX
|
- KX_CONSTRAINTACT_LOCX
|
||||||
- KX_CONSTRAINTACT_LOCY
|
- KX_CONSTRAINTACT_LOCY
|
||||||
- KX_CONSTRAINTACT_LOCZ
|
- KX_CONSTRAINTACT_LOCZ
|
||||||
@ -28,7 +56,7 @@ Constraint Actuator
|
|||||||
|
|
||||||
IPO Actuator
|
IPO Actuator
|
||||||
------------
|
------------
|
||||||
IPO Types
|
IPO Types. See L{KX_IpoActuator}
|
||||||
- KX_IPOACT_PLAY
|
- KX_IPOACT_PLAY
|
||||||
- KX_IPOACT_PINGPONG
|
- KX_IPOACT_PINGPONG
|
||||||
- KX_IPOACT_FLIPPER
|
- KX_IPOACT_FLIPPER
|
||||||
@ -37,6 +65,7 @@ IPO Actuator
|
|||||||
|
|
||||||
Random Distributions
|
Random Distributions
|
||||||
--------------------
|
--------------------
|
||||||
|
See L{SCA_RandomActuator}
|
||||||
- KX_RANDOMACT_BOOL_CONST
|
- KX_RANDOMACT_BOOL_CONST
|
||||||
- KX_RANDOMACT_BOOL_UNIFORM
|
- KX_RANDOMACT_BOOL_UNIFORM
|
||||||
- KX_RANDOMACT_BOOL_BERNOUILLI
|
- KX_RANDOMACT_BOOL_BERNOUILLI
|
||||||
@ -55,13 +84,13 @@ def getCurrentController():
|
|||||||
"""
|
"""
|
||||||
Gets the Python controller associated with this Python script.
|
Gets the Python controller associated with this Python script.
|
||||||
|
|
||||||
@rtype: SCA_PythonController
|
@rtype: L{SCA_PythonController}
|
||||||
"""
|
"""
|
||||||
def addActiveActuator(actuator, activate):
|
def addActiveActuator(actuator, activate):
|
||||||
"""
|
"""
|
||||||
Activates the given actuator.
|
Activates the given actuator.
|
||||||
|
|
||||||
@type actuator: SCA_IActuator
|
@type actuator: L{SCA_IActuator}
|
||||||
@type activate: boolean
|
@type activate: boolean
|
||||||
@param activate: whether to activate or deactivate the given actuator.
|
@param activate: whether to activate or deactivate the given actuator.
|
||||||
"""
|
"""
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# Documentation for CD Actuator
|
# Documentation for CD Actuator
|
||||||
from SCA_ILogicBrick import *
|
from SCA_IActuator import *
|
||||||
|
|
||||||
class KX_CDActuator(SCA_ILogicBrick):
|
class KX_CDActuator(SCA_IActuator):
|
||||||
def startCD():
|
def startCD():
|
||||||
"""
|
"""
|
||||||
Starts the CD playing.
|
Starts the CD playing.
|
||||||
|
@ -27,7 +27,7 @@ class KX_Camera(KX_GameObject):
|
|||||||
@ivar camera_to_world: This camera's camera to world transform. (read only)
|
@ivar camera_to_world: This camera's camera to world transform. (read only)
|
||||||
Regenerated every frame from the camera's position and orientation.
|
Regenerated every frame from the camera's position and orientation.
|
||||||
@type camera_to_world: 4x4 Matrix [[float]]
|
@type camera_to_world: 4x4 Matrix [[float]]
|
||||||
@ivar world_to_camera: This camera's world to camera transform. [[float]] (read only)
|
@ivar world_to_camera: This camera's world to camera transform. (read only)
|
||||||
Regenerated every frame from the camera's position and orientation.
|
Regenerated every frame from the camera's position and orientation.
|
||||||
This is camera_to_world inverted.
|
This is camera_to_world inverted.
|
||||||
@type world_to_camera: 4x4 Matrix [[float]]
|
@type world_to_camera: 4x4 Matrix [[float]]
|
||||||
@ -139,9 +139,11 @@ class KX_Camera(KX_GameObject):
|
|||||||
Example::
|
Example::
|
||||||
import GameLogic
|
import GameLogic
|
||||||
|
|
||||||
# Generate an identiy matrix.
|
def Scale(matrix, size):
|
||||||
def Identity():
|
for y in range(4):
|
||||||
return [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]
|
for x in range(4):
|
||||||
|
matrix[y][x] = matrix[y][x] * size[y]
|
||||||
|
return matrix
|
||||||
|
|
||||||
# Generate a perspective projection matrix
|
# Generate a perspective projection matrix
|
||||||
def Perspective(cam):
|
def Perspective(cam):
|
||||||
@ -159,21 +161,16 @@ class KX_Camera(KX_GameObject):
|
|||||||
[0.0 , 0.0 , 0.0 , 1.0 ]]
|
[0.0 , 0.0 , 0.0 , 1.0 ]]
|
||||||
|
|
||||||
# Generate an isometric projection matrix
|
# Generate an isometric projection matrix
|
||||||
def Isometric():
|
def Isometric(cam):
|
||||||
return [[0.866, 0.0 , 0.866, 0.0],
|
return Scale([[0.707, 0.0 , 0.707, 0.0],
|
||||||
[0.25 , 0.866,-0.25 , 0.0],
|
[0.408, 0.816,-0.408, 0.0],
|
||||||
[0.0 , 0.0 ,-1.0 , 0.0],
|
[0.0 , 0.0 , 0.0 , 0.0],
|
||||||
[0.0 , 0.0 , 0.0 , 1.0]]
|
[0.0 , 0.0 , 0.0 , 1.0]],
|
||||||
m = Identity()
|
[1.0/cam.scaling[0], 1.0/cam.scaling[1], 1.0/cam.scaling[2], 1.0])
|
||||||
m[0][0] = m[0][2] = m[1][1] = 0.8660254037844386
|
|
||||||
m[1][0] = 0.25
|
|
||||||
m[1][2] = -0.25
|
|
||||||
m[3][3] = 1.0
|
|
||||||
return m
|
|
||||||
|
|
||||||
co = GameLogic.getCurrentController()
|
co = GameLogic.getCurrentController()
|
||||||
cam = co.getOwner()
|
cam = co.getOwner()
|
||||||
cam.setProjectionMatrix(Perspective()))
|
cam.setProjectionMatrix(Perspective(cam)))
|
||||||
|
|
||||||
@type matrix: 4x4 matrix.
|
@type matrix: 4x4 matrix.
|
||||||
@param matrix: The new projection matrix for this camera.
|
@param matrix: The new projection matrix for this camera.
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# Documentation for KX_CameraActuator
|
# Documentation for KX_CameraActuator
|
||||||
from SCA_ILogicBrick import *
|
from SCA_IActuator import *
|
||||||
|
|
||||||
class KX_CameraActuator(SCA_ILogicBrick):
|
class KX_CameraActuator(SCA_IActuator):
|
||||||
"""
|
"""
|
||||||
Applies changes to a camera.
|
Applies changes to a camera.
|
||||||
|
|
||||||
|
72
source/gameengine/PyDoc/KX_ConstraintActuator.py
Normal file
72
source/gameengine/PyDoc/KX_ConstraintActuator.py
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_ConstraintActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_ConstraintActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
A constraint actuator limits the position or orientation of an object.
|
||||||
|
"""
|
||||||
|
def setDamp(time):
|
||||||
|
"""
|
||||||
|
Sets the time this constraint is delayed.
|
||||||
|
|
||||||
|
@param time: The number of frames to delay.
|
||||||
|
Negative values are ignored.
|
||||||
|
@type time: integer
|
||||||
|
"""
|
||||||
|
def getDamp():
|
||||||
|
"""
|
||||||
|
Returns the damping time of the constraint.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
"""
|
||||||
|
def setMin(lower):
|
||||||
|
"""
|
||||||
|
Sets the lower bound of the constraint.
|
||||||
|
|
||||||
|
For rotational constraints, lower is specified in degrees.
|
||||||
|
|
||||||
|
@type lower: float
|
||||||
|
"""
|
||||||
|
def getMin():
|
||||||
|
"""
|
||||||
|
Gets the lower bound of the constraint.
|
||||||
|
|
||||||
|
For rotational constraints, the lower bound is returned in radians.
|
||||||
|
|
||||||
|
@rtype: float
|
||||||
|
"""
|
||||||
|
def setMax(upper):
|
||||||
|
"""
|
||||||
|
Sets the upper bound of the constraint.
|
||||||
|
|
||||||
|
For rotational constraints, upper is specified in degrees.
|
||||||
|
|
||||||
|
@type upper: float
|
||||||
|
"""
|
||||||
|
def getMax():
|
||||||
|
"""
|
||||||
|
Gets the upper bound of the constraint.
|
||||||
|
|
||||||
|
For rotational constraints, the upper bound is returned in radians.
|
||||||
|
|
||||||
|
@rtype: float
|
||||||
|
"""
|
||||||
|
def setLimit(limit):
|
||||||
|
"""
|
||||||
|
Sets the type of constraint.
|
||||||
|
|
||||||
|
See module L{GameLogic} for valid constraint types.
|
||||||
|
|
||||||
|
@param limit: Position constraints: KX_CONSTRAINTACT_LOCX, KX_CONSTRAINTACT_LOCY, KX_CONSTRAINTACT_LOCZ,
|
||||||
|
Rotation constraints: KX_CONSTRAINTACT_ROTX, KX_CONSTRAINTACT_ROTY or KX_CONSTRAINTACT_ROTZ
|
||||||
|
"""
|
||||||
|
def getLimit():
|
||||||
|
"""
|
||||||
|
Gets the type of constraint.
|
||||||
|
|
||||||
|
See module L{GameLogic} for valid constraints.
|
||||||
|
|
||||||
|
@return: Position constraints: KX_CONSTRAINTACT_LOCX, KX_CONSTRAINTACT_LOCY, KX_CONSTRAINTACT_LOCZ,
|
||||||
|
Rotation constraints: KX_CONSTRAINTACT_ROTX, KX_CONSTRAINTACT_ROTY or KX_CONSTRAINTACT_ROTZ
|
||||||
|
"""
|
@ -1,4 +1,22 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# Documentation for KX_GameActuator
|
# Documentation for KX_GameActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_GameActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
The game actuator loads a new .blend file, restarts the current .blend file or quits the game.
|
||||||
|
"""
|
||||||
|
def getFile():
|
||||||
|
"""
|
||||||
|
Returns the filename of the new .blend file to load.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
||||||
|
def setFile(filename):
|
||||||
|
"""
|
||||||
|
Sets the new .blend file to load.
|
||||||
|
|
||||||
|
@param filename: The file name this actuator will load.
|
||||||
|
@type filename: string
|
||||||
|
"""
|
||||||
|
|
||||||
class KX_GameActuator:
|
|
||||||
|
@ -5,12 +5,11 @@ class KX_GameObject:
|
|||||||
"""
|
"""
|
||||||
All game objects are derived from this class.
|
All game objects are derived from this class.
|
||||||
|
|
||||||
Properties assigned to game objects are accessible as attributes
|
Properties assigned to game objects are accessible as attributes of this class.
|
||||||
in objects of this class.
|
|
||||||
|
|
||||||
@ivar mass: The object's mass (provided the object has a physics controller). float. read only
|
@ivar mass: The object's mass (provided the object has a physics controller). float. read only
|
||||||
@ivar parent: The object's parent object. (Read only)
|
@ivar parent: The object's parent object. (Read only)
|
||||||
@type parent: KX_GameObject
|
@type parent: L{KX_GameObject}
|
||||||
@ivar visible: visibility flag. boolean.
|
@ivar visible: visibility flag. boolean.
|
||||||
@ivar position: The object's position.
|
@ivar position: The object's position.
|
||||||
@type position: list [x, y, z]
|
@type position: list [x, y, z]
|
||||||
@ -129,7 +128,7 @@ class KX_GameObject:
|
|||||||
"""
|
"""
|
||||||
Gets this object's parent.
|
Gets this object's parent.
|
||||||
|
|
||||||
@rtype: game object
|
@rtype: L{KX_GameObject}
|
||||||
@return: this object's parent object, or None if this object has no parent.
|
@return: this object's parent object, or None if this object has no parent.
|
||||||
"""
|
"""
|
||||||
def getMesh(mesh):
|
def getMesh(mesh):
|
||||||
@ -138,7 +137,7 @@ class KX_GameObject:
|
|||||||
|
|
||||||
@type mesh: integer
|
@type mesh: integer
|
||||||
@param mesh: the mesh object to return (optional: default mesh = 0)
|
@param mesh: the mesh object to return (optional: default mesh = 0)
|
||||||
@rtype: mesh object
|
@rtype: L{KX_MeshProxy}
|
||||||
@return: the first mesh object associated with this game object, or None if this object has no meshs.
|
@return: the first mesh object associated with this game object, or None if this object has no meshs.
|
||||||
"""
|
"""
|
||||||
def getPhysicsId():
|
def getPhysicsId():
|
||||||
|
92
source/gameengine/PyDoc/KX_IpoActuator.py
Normal file
92
source/gameengine/PyDoc/KX_IpoActuator.py
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_IpoActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_IpoActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
IPO actuator activates an animation.
|
||||||
|
"""
|
||||||
|
def set(mode, startframe, endframe, force):
|
||||||
|
"""
|
||||||
|
Sets the properties of the actuator.
|
||||||
|
|
||||||
|
@param mode: "Play", "PingPong", "Flipper", "LoopStop", "LoopEnd" or "FromProp"
|
||||||
|
@type mode: string
|
||||||
|
@param startframe: first frame to use
|
||||||
|
@type startframe: integer
|
||||||
|
@param endframe: last frame to use
|
||||||
|
@type endframe: integer
|
||||||
|
@param force: interpret this ipo as a force
|
||||||
|
@type force: boolean (KX_TRUE, KX_FALSE)
|
||||||
|
"""
|
||||||
|
def setProperty(property):
|
||||||
|
"""
|
||||||
|
Sets the name of the property to be used in FromProp mode.
|
||||||
|
|
||||||
|
@type property: string
|
||||||
|
"""
|
||||||
|
def setStart(startframe):
|
||||||
|
"""
|
||||||
|
Sets the frame from which the IPO starts playing.
|
||||||
|
|
||||||
|
@type startframe: integer
|
||||||
|
"""
|
||||||
|
def getStart():
|
||||||
|
"""
|
||||||
|
Returns the frame from which the IPO starts playing.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
"""
|
||||||
|
def setEnd(endframe):
|
||||||
|
"""
|
||||||
|
Sets the frame at which the IPO stops playing.
|
||||||
|
|
||||||
|
@type endframe: integer
|
||||||
|
"""
|
||||||
|
def getEnd():
|
||||||
|
"""
|
||||||
|
Returns the frame at which the IPO stops playing.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
"""
|
||||||
|
def setIpoAsForce(force):
|
||||||
|
"""
|
||||||
|
Set whether to interpret the ipo as a force rather than a displacement.
|
||||||
|
|
||||||
|
@type force: boolean
|
||||||
|
@param force: KX_TRUE or KX_FALSE
|
||||||
|
"""
|
||||||
|
def getIpoAsForce():
|
||||||
|
"""
|
||||||
|
Returns whether to interpret the ipo as a force rather than a displacement.
|
||||||
|
|
||||||
|
@rtype: boolean
|
||||||
|
"""
|
||||||
|
def setType(mode):
|
||||||
|
"""
|
||||||
|
Sets the operation mode of the actuator.
|
||||||
|
|
||||||
|
@param mode: KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND
|
||||||
|
@type mode: string
|
||||||
|
"""
|
||||||
|
def getType():
|
||||||
|
"""
|
||||||
|
Returns the operation mode of the actuator.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
@return: KX_IPOACT_PLAY, KX_IPOACT_PINGPONG, KX_IPOACT_FLIPPER, KX_IPOACT_LOOPSTOP, KX_IPOACT_LOOPEND
|
||||||
|
"""
|
||||||
|
def setForceIpoActsLocal(local):
|
||||||
|
"""
|
||||||
|
Set whether to apply the force in the object's local
|
||||||
|
coordinates rather than the world global coordinates.
|
||||||
|
|
||||||
|
@param local: Apply the ipo-as-force in the object's local
|
||||||
|
coordinates? (KX_TRUE, KX_FALSE)
|
||||||
|
@type local: boolean
|
||||||
|
"""
|
||||||
|
def getForceIpoActsLocal():
|
||||||
|
"""
|
||||||
|
Return whether to apply the force in the object's local
|
||||||
|
coordinates rather than the world global coordinates.
|
||||||
|
"""
|
@ -52,7 +52,7 @@ class KX_MeshProxy:
|
|||||||
@param matid: the specified material
|
@param matid: the specified material
|
||||||
@type index: integer
|
@type index: integer
|
||||||
@param index: the index into the vertex array.
|
@param index: the index into the vertex array.
|
||||||
@rtype: KX_VertexProxy
|
@rtype: L{KX_VertexProxy}
|
||||||
@return: a vertex object.
|
@return: a vertex object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
36
source/gameengine/PyDoc/KX_NetworkMessageActuator.py
Normal file
36
source/gameengine/PyDoc/KX_NetworkMessageActuator.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_NetworkMessageActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_NetworkMessageActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Message Actuator
|
||||||
|
"""
|
||||||
|
def setToPropName(name):
|
||||||
|
"""
|
||||||
|
Messages will only be sent to objects with the given property name.
|
||||||
|
|
||||||
|
@type name: string
|
||||||
|
"""
|
||||||
|
def setSubject(subject):
|
||||||
|
"""
|
||||||
|
Sets the subject field of the message.
|
||||||
|
|
||||||
|
@type subject: string
|
||||||
|
"""
|
||||||
|
def setBodyType(bodytype):
|
||||||
|
"""
|
||||||
|
Sets the type of body to send.
|
||||||
|
|
||||||
|
@type bodytype: boolean
|
||||||
|
@param bodytype: True to send the value of a property, False to send the body text.
|
||||||
|
"""
|
||||||
|
def setBody(body):
|
||||||
|
"""
|
||||||
|
Sets the message body.
|
||||||
|
|
||||||
|
@type body: string
|
||||||
|
@param body: if the body type is True, this is the name of the property to send.
|
||||||
|
if the body type is False, this is the text to send.
|
||||||
|
"""
|
||||||
|
|
154
source/gameengine/PyDoc/KX_ObjectActuator.py
Normal file
154
source/gameengine/PyDoc/KX_ObjectActuator.py
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_ObjectActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_ObjectActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
The object actuator ("Motion Actuator") applies force, torque, displacement, angular displacement,
|
||||||
|
velocity, or angular velocity to an object.
|
||||||
|
"""
|
||||||
|
def getForce():
|
||||||
|
"""
|
||||||
|
Returns the force applied by the actuator.
|
||||||
|
|
||||||
|
@rtype: list [fx, fy, fz, local]
|
||||||
|
@return: A four item list, containing the vector force, and a flag specifying whether the force is local.
|
||||||
|
"""
|
||||||
|
def setForce(fx, fy, fz, local):
|
||||||
|
"""
|
||||||
|
Sets the force applied by the actuator.
|
||||||
|
|
||||||
|
@type fx: float
|
||||||
|
@param fx: the x component of the force.
|
||||||
|
@type fy: float
|
||||||
|
@param fy: the z component of the force.
|
||||||
|
@type fz: float
|
||||||
|
@param fz: the z component of the force.
|
||||||
|
@type local: boolean
|
||||||
|
@param local: - False: the force is applied in world coordinates.
|
||||||
|
- True: the force is applied in local coordinates.
|
||||||
|
"""
|
||||||
|
def getTorque():
|
||||||
|
"""
|
||||||
|
Returns the torque applied by the actuator.
|
||||||
|
|
||||||
|
@rtype: list [S{Tau}x, S{Tau}y, S{Tau}z, local]
|
||||||
|
@return: A four item list, containing the vector torque, and a flag specifying whether
|
||||||
|
the torque is applied in local coordinates (True) or world coordinates (False)
|
||||||
|
"""
|
||||||
|
def setTorque(tx, ty, tz, local):
|
||||||
|
"""
|
||||||
|
Sets the torque applied by the actuator.
|
||||||
|
|
||||||
|
@type tx: float
|
||||||
|
@param tx: the x component of the torque.
|
||||||
|
@type ty: float
|
||||||
|
@param ty: the z component of the torque.
|
||||||
|
@type tz: float
|
||||||
|
@param tz: the z component of the torque.
|
||||||
|
@type local: boolean
|
||||||
|
@param local: - False: the torque is applied in world coordinates.
|
||||||
|
- True: the torque is applied in local coordinates.
|
||||||
|
"""
|
||||||
|
def getDLoc():
|
||||||
|
"""
|
||||||
|
Returns the displacement vector applied by the actuator.
|
||||||
|
|
||||||
|
@rtype: list [dx, dy, dz, local]
|
||||||
|
@return: A four item list, containing the vector displacement, and whether
|
||||||
|
the displacement is applied in local coordinates (True) or world
|
||||||
|
coordinates (False)
|
||||||
|
"""
|
||||||
|
def setDLoc(dx, dy, dz, local):
|
||||||
|
"""
|
||||||
|
Sets the displacement vector applied by the actuator.
|
||||||
|
|
||||||
|
Since the displacement is applied every frame, you must adjust the displacement
|
||||||
|
based on the frame rate, or you game experience will depend on the player's computer
|
||||||
|
speed.
|
||||||
|
|
||||||
|
@type dx: float
|
||||||
|
@param dx: the x component of the displacement vector.
|
||||||
|
@type dy: float
|
||||||
|
@param dy: the z component of the displacement vector.
|
||||||
|
@type dz: float
|
||||||
|
@param dz: the z component of the displacement vector.
|
||||||
|
@type local: boolean
|
||||||
|
@param local: - False: the displacement vector is applied in world coordinates.
|
||||||
|
- True: the displacement vector is applied in local coordinates.
|
||||||
|
"""
|
||||||
|
def getDRot():
|
||||||
|
"""
|
||||||
|
Returns the angular displacement vector applied by the actuator.
|
||||||
|
|
||||||
|
@rtype: list [dx, dy, dz, local]
|
||||||
|
@return: A four item list, containing the angular displacement vector, and whether
|
||||||
|
the displacement is applied in local coordinates (True) or world
|
||||||
|
coordinates (False)
|
||||||
|
"""
|
||||||
|
def setDRot(dx, dy, dz, local):
|
||||||
|
"""
|
||||||
|
Sets the angular displacement vector applied by the actuator.
|
||||||
|
|
||||||
|
Since the displacement is applied every frame, you must adjust the displacement
|
||||||
|
based on the frame rate, or you game experience will depend on the player's computer
|
||||||
|
speed.
|
||||||
|
|
||||||
|
@type dx: float
|
||||||
|
@param dx: the x component of the angular displacement vector.
|
||||||
|
@type dy: float
|
||||||
|
@param dy: the z component of the angular displacement vector.
|
||||||
|
@type dz: float
|
||||||
|
@param dz: the z component of the angular displacement vector.
|
||||||
|
@type local: boolean
|
||||||
|
@param local: - False: the angular displacement vector is applied in world coordinates.
|
||||||
|
- True: the angular displacement vector is applied in local coordinates.
|
||||||
|
"""
|
||||||
|
def getLinearVelocity():
|
||||||
|
"""
|
||||||
|
Returns the linear velocity applied by the actuator.
|
||||||
|
|
||||||
|
@rtype: list [vx, vy, vz, local]
|
||||||
|
@return: A four item list, containing the vector velocity, and whether
|
||||||
|
the velocity is applied in local coordinates (True) or world
|
||||||
|
coordinates (False)
|
||||||
|
"""
|
||||||
|
def setLinearVelocity(vx, vy, vz, local):
|
||||||
|
"""
|
||||||
|
Sets the linear velocity applied by the actuator.
|
||||||
|
|
||||||
|
@type vx: float
|
||||||
|
@param vx: the x component of the velocity vector.
|
||||||
|
@type vy: float
|
||||||
|
@param vy: the z component of the velocity vector.
|
||||||
|
@type vz: float
|
||||||
|
@param vz: the z component of the velocity vector.
|
||||||
|
@type local: boolean
|
||||||
|
@param local: - False: the velocity vector is applied in world coordinates.
|
||||||
|
- True: the velocity vector is applied in local coordinates.
|
||||||
|
"""
|
||||||
|
def getAngularVelocity():
|
||||||
|
"""
|
||||||
|
Returns the angular velocity applied by the actuator.
|
||||||
|
|
||||||
|
@rtype: list [S{omega}x, S{omega}y, S{omega}z, local]
|
||||||
|
@return: A four item list, containing the vector velocity, and whether
|
||||||
|
the velocity is applied in local coordinates (True) or world
|
||||||
|
coordinates (False)
|
||||||
|
"""
|
||||||
|
def setAngularVelocity(wx, wy, wz, local):
|
||||||
|
"""
|
||||||
|
Sets the angular velocity applied by the actuator.
|
||||||
|
|
||||||
|
@type wx: float
|
||||||
|
@param wx: the x component of the velocity vector.
|
||||||
|
@type wy: float
|
||||||
|
@param wy: the z component of the velocity vector.
|
||||||
|
@type wz: float
|
||||||
|
@param wz: the z component of the velocity vector.
|
||||||
|
@type local: boolean
|
||||||
|
@param local: - False: the velocity vector is applied in world coordinates.
|
||||||
|
- True: the velocity vector is applied in local coordinates.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
68
source/gameengine/PyDoc/KX_SCA_AddObjectActuator.py
Normal file
68
source/gameengine/PyDoc/KX_SCA_AddObjectActuator.py
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_SCA_AddObjectActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_SCA_AddObjectActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Edit Object Actuator (in Add Object Mode)
|
||||||
|
|
||||||
|
@warning: Add Object actuators will be ignored if at game start, the linked object doesn't exist
|
||||||
|
(or is empty) or the linked object is in an active layer.
|
||||||
|
|
||||||
|
This will genereate a warning in the console:
|
||||||
|
|
||||||
|
C{ERROR: GameObject I{OBName} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
|
||||||
|
"""
|
||||||
|
def setObject(name):
|
||||||
|
"""
|
||||||
|
Sets the name of the game object to add.
|
||||||
|
|
||||||
|
A copy of the named object will be added to the scene.
|
||||||
|
|
||||||
|
If the named object does not exist, this function is ignored.
|
||||||
|
|
||||||
|
@type name: string
|
||||||
|
"""
|
||||||
|
def getObject():
|
||||||
|
"""
|
||||||
|
Returns the name of the game object to be added.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
||||||
|
def setTime(time):
|
||||||
|
"""
|
||||||
|
Sets the lifetime of added objects, in frames.
|
||||||
|
|
||||||
|
@type time: integer
|
||||||
|
@param time: The minimum value for time is 0.
|
||||||
|
"""
|
||||||
|
def getTime():
|
||||||
|
"""
|
||||||
|
Returns the lifetime of the added object, in frames.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
"""
|
||||||
|
def setLinearVelocity(vx, vy, vz):
|
||||||
|
"""
|
||||||
|
Sets the initial linear velocity of added objects.
|
||||||
|
|
||||||
|
@type vx: float
|
||||||
|
@param vx: the x component of the initial linear velocity.
|
||||||
|
@type vy: float
|
||||||
|
@param vy: the y component of the initial linear velocity.
|
||||||
|
@type vz: float
|
||||||
|
@param vz: the z component of the initial linear velocity.
|
||||||
|
"""
|
||||||
|
def getLinearVelocity():
|
||||||
|
"""
|
||||||
|
Returns the initial linear velocity of added objects.
|
||||||
|
|
||||||
|
@rtype: list [vx, vy, vz]
|
||||||
|
"""
|
||||||
|
def getLastCreatedObject():
|
||||||
|
"""
|
||||||
|
Returns the last object created by this actuator.
|
||||||
|
|
||||||
|
@rtype: L{KX_GameObject}
|
||||||
|
@return: A L{KX_GameObject} or None if no object has been created.
|
||||||
|
"""
|
11
source/gameengine/PyDoc/KX_SCA_EndObjectActuator.py
Normal file
11
source/gameengine/PyDoc/KX_SCA_EndObjectActuator.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_SCA_EndObjectActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_SCA_EndObjectActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Edit Object Actuator (in End Object mode)
|
||||||
|
|
||||||
|
This actuator has no python methods.
|
||||||
|
"""
|
||||||
|
|
23
source/gameengine/PyDoc/KX_SCA_ReplaceMeshActuator.py
Normal file
23
source/gameengine/PyDoc/KX_SCA_ReplaceMeshActuator.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_SCA_ReplaceMeshActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_SCA_ReplaceMeshActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Edit Object actuator, in Replace Mesh mode.
|
||||||
|
|
||||||
|
@warning: Replace mesh actuators will be ignored if at game start, the
|
||||||
|
named mesh doesn't exist.
|
||||||
|
|
||||||
|
This will generate a warning in the console:
|
||||||
|
|
||||||
|
C{ERROR: GameObject I{OBName} ReplaceMeshActuator I{ActuatorName} without object}
|
||||||
|
|
||||||
|
"""
|
||||||
|
def setMesh(name):
|
||||||
|
"""
|
||||||
|
Sets the name of the mesh that will replace the current one.
|
||||||
|
|
||||||
|
@type name: string
|
||||||
|
"""
|
||||||
|
|
51
source/gameengine/PyDoc/KX_SceneActuator.py
Normal file
51
source/gameengine/PyDoc/KX_SceneActuator.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_SceneActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_SceneActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Scene Actuator logic brick.
|
||||||
|
|
||||||
|
@warning: Scene actuators that use a scene name will be ignored if at game start, the
|
||||||
|
named scene doesn't exist or is empty
|
||||||
|
|
||||||
|
This will generate a warning in the console:
|
||||||
|
|
||||||
|
C{ERROR: GameObject I{OBName} has a SceneActuator I{ActuatorName} (SetScene) without scene}
|
||||||
|
"""
|
||||||
|
def setUseRestart(flag):
|
||||||
|
"""
|
||||||
|
Set flag to True to restart the scene.
|
||||||
|
|
||||||
|
@type flag: boolean
|
||||||
|
"""
|
||||||
|
def setScene(scene):
|
||||||
|
"""
|
||||||
|
Sets the name of the scene to change to/overlay/underlay/remove/suspend/resume.
|
||||||
|
|
||||||
|
@type scene: string
|
||||||
|
"""
|
||||||
|
def setCamera(camera):
|
||||||
|
"""
|
||||||
|
Sets the name of the camera to change to.
|
||||||
|
|
||||||
|
@type camera: string
|
||||||
|
"""
|
||||||
|
def getUseRestart():
|
||||||
|
"""
|
||||||
|
Returns True if the scene will be restarted.
|
||||||
|
|
||||||
|
@rtype: boolean
|
||||||
|
"""
|
||||||
|
def getScene():
|
||||||
|
"""
|
||||||
|
Returns the name of the scene to change to/overlay/underlay/remove/suspend/resume.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
||||||
|
def getCamera():
|
||||||
|
"""
|
||||||
|
Returns the name of the camera to change to.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
129
source/gameengine/PyDoc/KX_SoundActuator.py
Normal file
129
source/gameengine/PyDoc/KX_SoundActuator.py
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_SoundActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_SoundActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Sound Actuator.
|
||||||
|
|
||||||
|
The L{startSound()}, L{pauseSound()} and L{stopSound()} do not require
|
||||||
|
the actuator to be activated - they act instantly.
|
||||||
|
|
||||||
|
@group Play Methods: startSound, pauseSound, stopSound
|
||||||
|
"""
|
||||||
|
def setFilename(filename):
|
||||||
|
"""
|
||||||
|
Sets the filename of the sound this actuator plays.
|
||||||
|
|
||||||
|
@type filename: string
|
||||||
|
"""
|
||||||
|
def getFilename():
|
||||||
|
"""
|
||||||
|
Returns the filename of the sound this actuator plays.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
||||||
|
def startSound():
|
||||||
|
"""
|
||||||
|
Starts the sound.
|
||||||
|
"""
|
||||||
|
def pauseSound():
|
||||||
|
"""
|
||||||
|
Pauses the sound.
|
||||||
|
"""
|
||||||
|
def stopSound():
|
||||||
|
"""
|
||||||
|
Stops the sound.
|
||||||
|
"""
|
||||||
|
def setGain(gain):
|
||||||
|
"""
|
||||||
|
Sets the gain (volume) of the sound
|
||||||
|
|
||||||
|
@type gain: float
|
||||||
|
@param gain: 0.0 (quiet) <= gain <= 1.0 (loud)
|
||||||
|
"""
|
||||||
|
def getGain():
|
||||||
|
"""
|
||||||
|
Gets the gain (volume) of the sound.
|
||||||
|
|
||||||
|
@rtype: float
|
||||||
|
"""
|
||||||
|
def setPitch(pitch):
|
||||||
|
"""
|
||||||
|
Sets the pitch of the sound.
|
||||||
|
|
||||||
|
@type pitch: float
|
||||||
|
"""
|
||||||
|
def getPitch():
|
||||||
|
"""
|
||||||
|
Returns the pitch of the sound.
|
||||||
|
|
||||||
|
@rtype: float
|
||||||
|
"""
|
||||||
|
def setRollOffFactor(rolloff):
|
||||||
|
"""
|
||||||
|
Sets the rolloff factor for the sounds.
|
||||||
|
|
||||||
|
Rolloff defines the rate of attenuation as the sound gets further away.
|
||||||
|
Higher rolloff factors shorten the distance at which the sound can be heard.
|
||||||
|
|
||||||
|
@type rolloff: float
|
||||||
|
"""
|
||||||
|
def getRollOffFactor():
|
||||||
|
"""
|
||||||
|
Returns the rolloff factor for the sound.
|
||||||
|
|
||||||
|
@rtype: float
|
||||||
|
"""
|
||||||
|
def setLooping(loop):
|
||||||
|
"""
|
||||||
|
Sets the loop mode of the actuator.
|
||||||
|
|
||||||
|
@bug: There are no constants defined for this method!
|
||||||
|
@param loop: - Play Stop 1
|
||||||
|
- Play End 2
|
||||||
|
- Loop Stop 3
|
||||||
|
- Loop End 4
|
||||||
|
- Bidirection Stop 5
|
||||||
|
- Bidirection End 6
|
||||||
|
@type loop: integer
|
||||||
|
"""
|
||||||
|
def getLooping():
|
||||||
|
"""
|
||||||
|
Returns the current loop mode of the actuator.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
"""
|
||||||
|
def setPosition(x, y, z):
|
||||||
|
"""
|
||||||
|
Sets the position this sound will come from.
|
||||||
|
|
||||||
|
@type x: float
|
||||||
|
@param x: The x coordinate of the sound.
|
||||||
|
@type y: float
|
||||||
|
@param y: The y coordinate of the sound.
|
||||||
|
@type z: float
|
||||||
|
@param z: The z coordinate of the sound.
|
||||||
|
"""
|
||||||
|
def setVelocity(vx, vy, vz):
|
||||||
|
"""
|
||||||
|
Sets the velocity this sound is moving at.
|
||||||
|
|
||||||
|
The sound's pitch is determined from the velocity.
|
||||||
|
|
||||||
|
@type vx: float
|
||||||
|
@param vx: The vx coordinate of the sound.
|
||||||
|
@type vy: float
|
||||||
|
@param vy: The vy coordinate of the sound.
|
||||||
|
@type vz: float
|
||||||
|
@param vz: The vz coordinate of the sound.
|
||||||
|
"""
|
||||||
|
def setOrientation(o11, o12, o13, o21, o22, o23, o31, o32, o33):
|
||||||
|
"""
|
||||||
|
Sets the orientation of the sound.
|
||||||
|
|
||||||
|
The nine parameters specify a rotation matrix::
|
||||||
|
| o11, o12, o13 |
|
||||||
|
| o21, o22, o23 |
|
||||||
|
| o31, o32, o33 |
|
||||||
|
"""
|
@ -26,7 +26,7 @@ class KX_TouchSensor(SCA_ISensor):
|
|||||||
"""
|
"""
|
||||||
Returns the last object hit by this touch sensor.
|
Returns the last object hit by this touch sensor.
|
||||||
|
|
||||||
@rtype: KX_GameObject
|
@rtype: L{KX_GameObject}
|
||||||
"""
|
"""
|
||||||
def getHitObjectList():
|
def getHitObjectList():
|
||||||
"""
|
"""
|
||||||
@ -34,7 +34,7 @@ class KX_TouchSensor(SCA_ISensor):
|
|||||||
|
|
||||||
Only objects that have the requisite material/property are listed.
|
Only objects that have the requisite material/property are listed.
|
||||||
|
|
||||||
@rtype: list [KX_GameObject]
|
@rtype: list [L{KX_GameObject}]
|
||||||
"""
|
"""
|
||||||
def getTouchMaterial():
|
def getTouchMaterial():
|
||||||
"""
|
"""
|
||||||
|
55
source/gameengine/PyDoc/KX_TrackToActuator.py
Normal file
55
source/gameengine/PyDoc/KX_TrackToActuator.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_TrackToActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_TrackToActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Edit Object actuator in Track To mode.
|
||||||
|
|
||||||
|
@warning: Track To Actuators will be ignored if at game start, the
|
||||||
|
object to track to is invalid.
|
||||||
|
|
||||||
|
This will generate a warning in the console:
|
||||||
|
|
||||||
|
C{ERROR: GameObject I{OBName} no object in EditObjectActuator I{ActuatorName}}
|
||||||
|
|
||||||
|
"""
|
||||||
|
def setObject(object):
|
||||||
|
"""
|
||||||
|
Sets the object to track.
|
||||||
|
|
||||||
|
@type object: string
|
||||||
|
@param object: the name of the object to track.
|
||||||
|
"""
|
||||||
|
def getObject():
|
||||||
|
"""
|
||||||
|
Returns the name of the object to track.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
||||||
|
def setTime(time):
|
||||||
|
"""
|
||||||
|
Sets the time in frames with which to delay the tracking motion.
|
||||||
|
|
||||||
|
@type time: integer
|
||||||
|
"""
|
||||||
|
def getTime():
|
||||||
|
"""
|
||||||
|
Returns the time in frames with which the tracking motion is delayed.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
"""
|
||||||
|
def setUse3D(use3d):
|
||||||
|
"""
|
||||||
|
Sets the tracking motion to use 3D.
|
||||||
|
|
||||||
|
@type use3d: boolean
|
||||||
|
@param use3d: - True: allow the tracking motion to extend in the z-direction.
|
||||||
|
- False: lock the tracking motion to the x-y plane.
|
||||||
|
"""
|
||||||
|
def getUse3D():
|
||||||
|
"""
|
||||||
|
Returns True if the tracking motion will track in the z direction.
|
||||||
|
|
||||||
|
@rtype: boolean
|
||||||
|
"""
|
17
source/gameengine/PyDoc/KX_VisibilityActuator.py
Normal file
17
source/gameengine/PyDoc/KX_VisibilityActuator.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_VisibilityActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class KX_VisibilityActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Visibility Actuator.
|
||||||
|
"""
|
||||||
|
def set(visible):
|
||||||
|
"""
|
||||||
|
Sets whether the actuator makes its parent object visible or invisible.
|
||||||
|
|
||||||
|
@param visible: - True: Makes its parent visible.
|
||||||
|
- False: Makes its parent invisible.
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
@ -2,8 +2,42 @@
|
|||||||
"""
|
"""
|
||||||
Documentation for the Rasterizer module.
|
Documentation for the Rasterizer module.
|
||||||
|
|
||||||
Usage:
|
Example Uses an L{SCA_MouseSensor}, and two L{KX_ObjectActuator}s to implement MouseLook::
|
||||||
import Rasterizer
|
# To use a mouse movement sensor "Mouse" and a
|
||||||
|
# motion actuator to mouse look:
|
||||||
|
import Rasterizer
|
||||||
|
import GameLogic
|
||||||
|
|
||||||
|
# SCALE sets the speed of motion
|
||||||
|
SCALE=[1, 0.5]
|
||||||
|
|
||||||
|
co = GameLogic.getCurrentController()
|
||||||
|
obj = co.getOwner()
|
||||||
|
mouse = co.getSensor("Mouse")
|
||||||
|
lmotion = co.getActuator("LMove")
|
||||||
|
wmotion = co.getActuator("WMove")
|
||||||
|
|
||||||
|
# Transform the mouse coordinates to see how far the mouse has moved.
|
||||||
|
def mousePos():
|
||||||
|
x = (Rasterizer.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0]
|
||||||
|
y = (Rasterizer.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1]
|
||||||
|
return (x, y)
|
||||||
|
|
||||||
|
pos = mousePos()
|
||||||
|
|
||||||
|
# Set the amount of motion: X is applied in world coordinates...
|
||||||
|
lmotion.setTorque(0.0, 0.0, pos[0], False)
|
||||||
|
# ...Y is applied in local coordinates
|
||||||
|
wmotion.setTorque(-pos[1], 0.0, 0.0, True)
|
||||||
|
|
||||||
|
# Activate both actuators
|
||||||
|
GameLogic.addActiveActuator(lmotion, True)
|
||||||
|
GameLogic.addActiveActuator(wmotion, True)
|
||||||
|
|
||||||
|
# Centre the mouse
|
||||||
|
Rasterizer.setMousePosition(Rasterizer.getWindowWidth()/2, Rasterizer.getWindowHeight()/2)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def getWindowWidth():
|
def getWindowWidth():
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# Documentation for SCA_ANDController
|
# Documentation for SCA_ANDController
|
||||||
from SCA_ILogicBrick import *
|
from SCA_IController import *
|
||||||
|
|
||||||
class SCA_ANDController(SCA_ILogicBrick):
|
class SCA_ANDController(SCA_IController):
|
||||||
"""
|
"""
|
||||||
An AND controller activates only when all linked sensors are activated.
|
An AND controller activates only when all linked sensors are activated.
|
||||||
|
|
||||||
|
9
source/gameengine/PyDoc/SCA_IActuator.py
Normal file
9
source/gameengine/PyDoc/SCA_IActuator.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for SCA_IActuator
|
||||||
|
from SCA_ILogicBrick import *
|
||||||
|
|
||||||
|
class SCA_IActuator(SCA_ILogicBrick):
|
||||||
|
"""
|
||||||
|
Base class for all actuator logic bricks.
|
||||||
|
"""
|
||||||
|
|
9
source/gameengine/PyDoc/SCA_IController.py
Normal file
9
source/gameengine/PyDoc/SCA_IController.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for KX_CameraActuator
|
||||||
|
from SCA_ILogicBrick import *
|
||||||
|
|
||||||
|
class SCA_IController(SCA_ILogicBrick):
|
||||||
|
"""
|
||||||
|
Base class for all controller logic bricks.
|
||||||
|
"""
|
||||||
|
|
@ -4,14 +4,14 @@ from KX_GameObject import *
|
|||||||
|
|
||||||
class SCA_ILogicBrick:
|
class SCA_ILogicBrick:
|
||||||
"""
|
"""
|
||||||
Logic brick base class.
|
Base class for all logic bricks.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def getOwner():
|
def getOwner():
|
||||||
"""
|
"""
|
||||||
Gets the game object associated with this logic brick.
|
Gets the game object associated with this logic brick.
|
||||||
|
|
||||||
@rtype: KX_GameObject
|
@rtype: L{KX_GameObject}
|
||||||
"""
|
"""
|
||||||
def setExecutePriority(priority):
|
def setExecutePriority(priority):
|
||||||
"""
|
"""
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# Documentation for SCA_ORController
|
# Documentation for SCA_ORController
|
||||||
from SCA_ILogicBrick import *
|
from SCA_IController import *
|
||||||
|
|
||||||
class SCA_ORController(SCA_ILogicBrick):
|
class SCA_ORController(SCA_IController):
|
||||||
"""
|
"""
|
||||||
An OR controller activates when any connected sensor activates.
|
An OR controller activates when any connected sensor activates.
|
||||||
|
|
||||||
|
38
source/gameengine/PyDoc/SCA_PropertyActuator.py
Normal file
38
source/gameengine/PyDoc/SCA_PropertyActuator.py
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for SCA_PropertyActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class SCA_PropertyActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Property Actuator
|
||||||
|
"""
|
||||||
|
def setProperty(prop):
|
||||||
|
"""
|
||||||
|
Set the property on which to operate.
|
||||||
|
|
||||||
|
If there is no property of this name, the call is ignored.
|
||||||
|
|
||||||
|
@type prop: string
|
||||||
|
@param prop: The name of the property to set.
|
||||||
|
"""
|
||||||
|
def getProperty():
|
||||||
|
"""
|
||||||
|
Returns the name of the property on which to operate.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
||||||
|
def setValue(value):
|
||||||
|
"""
|
||||||
|
Set the value with which the actuator operates.
|
||||||
|
|
||||||
|
If the value is not compatible with the type of the
|
||||||
|
property, the subsequent action is ignored.
|
||||||
|
|
||||||
|
@type value: string
|
||||||
|
"""
|
||||||
|
def getValue():
|
||||||
|
"""
|
||||||
|
Gets the value with which this actuator operates.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
@ -1,8 +1,8 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
# Documentation for SCA_PythonController
|
# Documentation for SCA_PythonController
|
||||||
from SCA_ILogicBrick import *
|
from SCA_IController import *
|
||||||
|
|
||||||
class SCA_PythonController(SCA_ILogicBrick):
|
class SCA_PythonController(SCA_IController):
|
||||||
"""
|
"""
|
||||||
A Python controller uses a Python script to activate it's actuators,
|
A Python controller uses a Python script to activate it's actuators,
|
||||||
based on it's sensors.
|
based on it's sensors.
|
||||||
@ -12,27 +12,27 @@ class SCA_PythonController(SCA_ILogicBrick):
|
|||||||
"""
|
"""
|
||||||
Gets a list of all sensors attached to this controller.
|
Gets a list of all sensors attached to this controller.
|
||||||
|
|
||||||
@rtype: list [SCA_ISensor]
|
@rtype: list [L{SCA_ISensor}]
|
||||||
"""
|
"""
|
||||||
def getSensor(name):
|
def getSensor(name):
|
||||||
"""
|
"""
|
||||||
Gets the named linked sensor.
|
Gets the named linked sensor.
|
||||||
|
|
||||||
@type name: string
|
@type name: string
|
||||||
@rtype: SCA_ISensor
|
@rtype: L{SCA_ISensor}
|
||||||
"""
|
"""
|
||||||
def getActuators():
|
def getActuators():
|
||||||
"""
|
"""
|
||||||
Gets a list of all actuators linked to this controller.
|
Gets a list of all actuators linked to this controller.
|
||||||
|
|
||||||
@rtype: list [SCA_IActuator]
|
@rtype: list [L{SCA_IActuator}]
|
||||||
"""
|
"""
|
||||||
def getActuator(name):
|
def getActuator(name):
|
||||||
"""
|
"""
|
||||||
Gets the named linked actuator.
|
Gets the named linked actuator.
|
||||||
|
|
||||||
@type name: string
|
@type name: string
|
||||||
@rtype: SCA_IActuator
|
@rtype: L{SCA_IActuator}
|
||||||
"""
|
"""
|
||||||
def getScript():
|
def getScript():
|
||||||
"""
|
"""
|
||||||
|
143
source/gameengine/PyDoc/SCA_RandomActuator.py
Normal file
143
source/gameengine/PyDoc/SCA_RandomActuator.py
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
# $Id$
|
||||||
|
# Documentation for SCA_RandomActuator
|
||||||
|
from SCA_IActuator import *
|
||||||
|
|
||||||
|
class SCA_RandomActuator(SCA_IActuator):
|
||||||
|
"""
|
||||||
|
Random Actuator
|
||||||
|
"""
|
||||||
|
def setSeed(seed):
|
||||||
|
"""
|
||||||
|
Sets the seed of the random number generator.
|
||||||
|
|
||||||
|
Equal seeds produce equal series. If the seed is 0,
|
||||||
|
the generator will produce the same value on every call.
|
||||||
|
|
||||||
|
@type seed: integer
|
||||||
|
"""
|
||||||
|
def getSeed():
|
||||||
|
"""
|
||||||
|
Returns the initial seed of the generator.
|
||||||
|
|
||||||
|
@rtype: integer
|
||||||
|
"""
|
||||||
|
def getPara1():
|
||||||
|
"""
|
||||||
|
Returns the first parameter of the active distribution.
|
||||||
|
|
||||||
|
Refer to the documentation of the generator types for the meaning
|
||||||
|
of this value.
|
||||||
|
|
||||||
|
@rtype: float
|
||||||
|
"""
|
||||||
|
def getPara2():
|
||||||
|
"""
|
||||||
|
Returns the second parameter of the active distribution.
|
||||||
|
|
||||||
|
Refer to the documentation of the generator types for the meaning
|
||||||
|
of this value.
|
||||||
|
|
||||||
|
@rtype: float
|
||||||
|
"""
|
||||||
|
def getDistribution():
|
||||||
|
"""
|
||||||
|
Returns the type of random distribution.
|
||||||
|
|
||||||
|
@rtype: distribution type
|
||||||
|
@return: KX_RANDOMACT_BOOL_CONST, KX_RANDOMACT_BOOL_UNIFORM, KX_RANDOMACT_BOOL_BERNOUILLI,
|
||||||
|
KX_RANDOMACT_INT_CONST, KX_RANDOMACT_INT_UNIFORM, KX_RANDOMACT_INT_POISSON,
|
||||||
|
KX_RANDOMACT_FLOAT_CONST, KX_RANDOMACT_FLOAT_UNIFORM, KX_RANDOMACT_FLOAT_NORMAL,
|
||||||
|
KX_RANDOMACT_FLOAT_NEGATIVE_EXPONENTIAL
|
||||||
|
"""
|
||||||
|
def setProperty(property):
|
||||||
|
"""
|
||||||
|
Set the property to which the random value is assigned.
|
||||||
|
|
||||||
|
If the generator and property types do not match, the assignment is ignored.
|
||||||
|
|
||||||
|
@type property: string
|
||||||
|
@param property: The name of the property to set.
|
||||||
|
"""
|
||||||
|
def getProperty():
|
||||||
|
"""
|
||||||
|
Returns the name of the property to set.
|
||||||
|
|
||||||
|
@rtype: string
|
||||||
|
"""
|
||||||
|
def setBoolConst(value):
|
||||||
|
"""
|
||||||
|
Sets this generator to produce a constant boolean value.
|
||||||
|
|
||||||
|
@param value: The value to return.
|
||||||
|
@type value: boolean
|
||||||
|
"""
|
||||||
|
def setBoolUniform():
|
||||||
|
"""
|
||||||
|
Sets this generator to produce a uniform boolean distribution.
|
||||||
|
|
||||||
|
The generator will generate True or False with 50% chance.
|
||||||
|
"""
|
||||||
|
def setBoolBernouilli(value):
|
||||||
|
"""
|
||||||
|
Sets this generator to produce a Bernouilli distribution.
|
||||||
|
|
||||||
|
@param value: Specifies the proportion of False values to produce.
|
||||||
|
- 0.0: Always generate True
|
||||||
|
- 1.0: Always generate False
|
||||||
|
@type value: float
|
||||||
|
"""
|
||||||
|
def setIntConst(value):
|
||||||
|
"""
|
||||||
|
Sets this generator to always produce the given value.
|
||||||
|
|
||||||
|
@param value: the value this generator produces.
|
||||||
|
@type value: integer
|
||||||
|
"""
|
||||||
|
def setIntUniform(lower_bound, upper_bound):
|
||||||
|
"""
|
||||||
|
Sets this generator to produce a random value between the given lower and
|
||||||
|
upper bounds (inclusive).
|
||||||
|
|
||||||
|
@type lower_bound: integer
|
||||||
|
@type upper_bound: integer
|
||||||
|
"""
|
||||||
|
def setIntPoisson(value):
|
||||||
|
"""
|
||||||
|
Generate a Poisson-distributed number.
|
||||||
|
|
||||||
|
This performs a series of Bernouilli tests with parameter value.
|
||||||
|
It returns the number of tries needed to achieve succes.
|
||||||
|
|
||||||
|
@type value: float
|
||||||
|
"""
|
||||||
|
def setFloatConst(value):
|
||||||
|
"""
|
||||||
|
Always generate the given value.
|
||||||
|
|
||||||
|
@type value: float
|
||||||
|
"""
|
||||||
|
def setFloatUniform(lower_bound, upper_bound):
|
||||||
|
"""
|
||||||
|
Generates a random float between lower_bound and upper_bound with a
|
||||||
|
uniform distribution.
|
||||||
|
|
||||||
|
@type lower_bound: float
|
||||||
|
@type upper_bound: float
|
||||||
|
"""
|
||||||
|
def setFloatNormal(mean, standard_deviation):
|
||||||
|
"""
|
||||||
|
Generates a random float from the given normal distribution.
|
||||||
|
|
||||||
|
@type mean: float
|
||||||
|
@param mean: The mean (average) value of the generated numbers
|
||||||
|
@type standard_deviation: float
|
||||||
|
@param standard_deviation: The standard deviation of the generated numbers.
|
||||||
|
"""
|
||||||
|
def setFloatNegativeExponential(half_life):
|
||||||
|
"""
|
||||||
|
Generate negative-exponentially distributed numbers.
|
||||||
|
|
||||||
|
The half-life 'time' is characterized by half_life.
|
||||||
|
|
||||||
|
@type half_life: float
|
||||||
|
"""
|
Loading…
Reference in New Issue
Block a user