| Class KX_ConstraintActuator (2.48) |
|
|
| getDamp |
setDamp |
| getDirection |
setDirection |
| getDistance |
setDistance |
| getLimit |
setLimit |
| getMax |
setMax |
| getMin |
setMin |
| getOption |
setOption |
| getProperty |
setProperty |
| getRayLength |
setRayLength |
| getRotDamp |
setRotDamp |
| getTime |
setTime |
|
|
|
| getExecutePriority |
setExecutePriority |
| getOwner |
---------- |
|
|
getDamp
getDamp()
Returns the damping time of the constraint.
Return type: integer
Sample
Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the damping time
damp = act.getDamp()
getDirection
getDirection()
Orientation Constraint only.
Returns the direction of the orientation constraint.
Return type: float list [xVec, yVec, zVec]
xVec:
cosine of the angle of the x axis
yVec: cosine of the angle of the y axis
zVec: cosine of the angle of the z axis
Sample
Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the direction of the orientation constraint
dirVect = act.getDirection()
getDistance
getDistance()
Distance Constraint only
Returns the distance that the game object has been set to maintain from
the surface of an object.
Return Type: float -- Blender Unit
Sample
Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the distance to stay above surface.
dist = act.getDistance()
getLimit
getLimit()
Returns the type of position constraint.
Return type: integer
0 = None
1 = KX_CONSTRAINTACT_LOCX
2 = KX_CONSTRAINTACT_LOCY
3 = KX_CONSTRAINTACT_LOCZ
Sample
Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the type of constraint
constraintType = act.getLimit()
getMax
getMax()
Returns the upper limit for this constraint.
Return type: float number
Sample
Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the upper limit
upperLimit = act.getMax()
getMin
getMin()
Returns the lower limit for this constraint.
Return type: float number
Sample
Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the lower limit
lowerLimit = act.getMin()
getOption
getOption()
Distance Constraint only.
Returns the sum of the option values.
Options:
64 =
Normal button selected.
128 = Material/Property toggle button set to Material
256 = PER button selected.
512 = Distance button selected.
Return type: integer
Note:
0 = No options selected.
192 = 64 + 128 = Normal button and Material selected
etc.
Sample
Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the option
option = act.getOption()
getProperty
getProperty()
Distance Constraint only.
Returns the name of the property the distance constraint looks for.
Return type: string
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the name of the property
prop = act.getProperty()
getRayLength
getRayLength()
Distance Constraint only.
Returns the maximum length of the distance constraint ray.
Return type: float -- Blender units
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the length of the ray
rayLen = act.getRayLength()
getRotDamp
getRotDamp()
Distance Constraint only.
Returns the time to use for damping the game object rotation caused by
the distance constraint.
Return type: integer
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the distance constraint rotation damping
rotDamp = act.getRotDamp()
getTime
getTime()
Distance and Orientation Constraints only.
Returns the maximum activation time of the constraint.
Return type: integer
Note:
0 = forever
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# get the max activation time
maxTime = act.getTime()
setDamp
setDamp(time)
Sets the damping time of the constraint.
time:
Type is integer
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the damping time
act.setDamp(1)
setDirection
setDirection(vector)
Orientation Constraint only.
Sets the direction of the orientation constraint vector.
vector:
Type: float list [xVec, yVec, zVec]
xVec:
cosine of the angle of the x axis
yVec: cosine of the angle of the y axis
zVec: cosine of the angle of the z axis
Note:
The
orientation constraint forces the selected axis of a game object to
point in a direction (a vector in World coordinates).
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the vector direction to world z-axis
act.setDirection([0.0, 0.0, 1.0])
# use it
GameLogic.addActiveActuator(act, True)
setDistance
setDistance(dist)
Distance Constraint Only
Sets the distance for the game object to maintain from the surface of
an object.
dist:
Type:
float -- Blender Unit
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the distance to stay above surface.
act.setDistance(1.2)
# use it
GameLogic.addActiveActuator(act, True)
setLimit
setLimit(limit)
Sets the type of position constraint.
limit:
Type is integer
0 = None
1 = KX_CONSTRAINTACT_LOCX
2 = KX_CONSTRAINTACT_LOCY
3 = KX_CONSTRAINTACT_LOCZ
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the constraint to LOCY
act.setLimit(2)
setMax
setMax(upper)
Sets the upper limit for this constraint.
upper:
Type is a
float number
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the upper limit
act.setMax(2.5)
setMin
setMin(lower)
Sets the lower limit for this constraint.
lower:
Type is a float
number
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the lower limit
act.setMin(0.5)
setOption
setOption(sum)
Distance Constraint only.
Sets the options for the distance constraint.
Options:
64 =
Normal button selected.
128 = Material/Property toggle button set to Material
256 = PER button selected.
512 = Distance button selected.
sum:
Type:
integer
Note:
0 = No options selected.
192 = 64 + 128 = Normal button and Material selected
etc.
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the Normal button
act.setOption(64)
#use it
GameLogic.addActiveActuator(act, True)
setProperty
setProperty(name)
Distance Constraint only.
Sets the name of the property the distance constraint looks for.
name:
Type:
string
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set property that distance constraint looks for to
floor
act.setProperty("floor")
#use it
GameLogic.addActiveActuator(act, True)
setRayLength
setRayLength(len)
Distance Constraint only.
Sets the maximum length of the distance constraint ray.
len:
Type:
float -- Blender units
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the length of the ray
act.getRayLength(3.5)
#use it
GameLogic.addActiveActuator(act, True)
setRotDamp
setRotDamp(time)
Distance Constraint only.
Sets the time to use for damping the game object rotation caused by the
distance constraint.
Time:
Type:
integer
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the distance constraint rotation damping
act.setRotDamp(10)
# use it
GameLogic.addActiveActuator(act, True)
setTime
setTime(time)
Distance and Orientation Constraints only.
Sets the maximum activation time of the constraint.
Time:
Type:
integer
Note:
0 = forever
Sample Code
# get the controller
controller = GameLogic.getCurrentController()
# get the constraint actuator attached to the controller
named act
act = controller.getActuator("act")
# set the max activation time to forever
act.setTime(0)
# use it
GameLogic.addActiveActuator(act, True)
|