|
| color / colour |
quad_attenuation |
| distance |
spotblend |
| energy |
spotsize |
| layer |
type |
| lin_attenuation |
---------- |
|
|
| NORMAL |
SUN |
| SPOT |
---------- |
|
|
|
| alignAxisToVect |
getState |
| applyImpulse |
getVectTo |
| disableRigidBody |
getVelocity |
| enableRigidBody |
getVisible |
| endObject |
rayCast |
| getAngularVelocity |
rayCastTo |
| getAxisVect |
removeParent |
| getChildren |
restoreDynamics |
| getChildrenRecursive |
setAngularVelocity |
| getDistanceTo |
setCollisionMargin |
| getLinearVelocity |
setLinearVelocity |
| getMass |
setOrientation |
| getMesh |
setParent |
| getOrientation |
setPosition |
| getParent |
setState |
| getPhysicsId |
setVisible |
| getPosition |
setWorldPosition |
| getPropertyNames |
suspendDynamics |
| getReactionForce |
---------- |
|
|
|
| mass |
position |
| name |
scaling |
| orientation |
timeOffset |
| parent |
visible |
|
|
color / colour
color / colour
get/set the color of the light
Type: list [ r, g, b] -- float
r: red channel
Type: float from 0.0
to 1.0
g: green channel
Type: float from 0.0
to 1.0
b: blue channel
Type: float from 0.0
to 1.0
Sample Code
###### get light color
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get the color of Lamp
col = light.color
###### set light color
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set the color of Lamp to red
light.color = [ 1.0, 0.0, 0.0]
distance
distance
get/set the maximum distance the light illuminates.
Type: float number
Sample Code
###### get light distance
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get the distance light reaches
dist = light.distance
###### set light distance
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set max distance
light.distance = 50.5
energy
energy
get/set the brightness of the light
Type: float number
Sample Code
###### get light energy
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get the brightness
bright = light.energy
###### set light energy
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set the brightness
light.energy = 2.5
layer
layer
get/set the layer mask on which this light will illuminate objects.
Type: interger
1 = layer 1
2 = layer 2
4 = layer 3
8 = layer 4
16 = layer 5
32 = layer 6
etc.
Note:
A lamp can be on more than one layer.
If the light is on layer 1, layer 2
and layer 3
layer = light.layer will return 7
1 (for layer 1) + 2 (for layer 2) + 4 (for layer 3)
Note:
For a light to illuminate an object on a layer, the
lamp must be on that layer.
If
a lamp is on layer 2, you can tell it to illuminate layer 1
(light.layer = 1) but since it isn't on layer 1, it won't
illuminate
objects on layer 1.
Sample Code
###### get light layer mask
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get the layer(s) that the light illuminates
layers = light.layer
###### set light layer mask
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set the light to illuminate layers to 1, 2 and 4
light.layer = 11
lin_attenuation
lin_attenuation
get/set the linear component of the light's attenuation.
SPOT and NORMAL (lamp) lights only
Type: float from 0.0 to 1.0
Sample Code
###### get light lin_attenuation
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get linear component
falloff = light.lin_attenuation
###### set light lin_attenuation
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set the linear component
light.lin_attenuation = 0.5
quad_attenuation
quad_attenuation
get/set the quadratic component of the light's attenuation.
SPOT and NORMAL (lamp) lights only
Type: float from 0.0 to 1.0
Sample Code
###### get light quad_attenuation
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get quad component
falloff = light.quad_attenuation
###### set light quad_attenuation
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set the quad component
light.quad_attenuation = 0.5
spotblend
spotblend
get/set the softness of the spotlight edge.
Type: float from 0.0 to 1.0
Sample Code
###### get softness of spotlight edge
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the spotlight named Spotlight
light = lightList["OBSpotLight"]
# get softness of spotlight edge
softness = light.spotblend
###### set softness of spotlight edge
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the spotlight named Spotlight
light = lightList["OBSpotLight"]
# set the softness
light.spotblend = 0.15
spotsize
spotsize
get/set the cone angle of the spot light.
Type: float
degrees from 1 to 180
Sample Code
###### get cone angle of spotlight
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get the cone angle of the spotlight
angle = light.spotsize
###### set cone angle of spotlight
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set the cone angle
light.spotsize = 50.0
type
type
get/set the type of light
0 = SPOT
1 = SUN
2 = NORMAL (lamp)
Note:
Only works correctly with SPOT, SUN or NORMAL.
Both Hemi and Area return 2. The same as
NORMAL
Sample Code
###### get type of light
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# get the kind of light
kind = light.type
###### set type of light
# get the current scene
scene = GameLogic.getCurrentScene()
# get a list of the lights in the scene
lightList = scene.getLightList()
# get the light named Lamp
light = lightList["OBLamp"]
# set to it to SUN
light.type = 1
Constants
NORMAL
NORMAL
light source is a lamp.
Sample Code
# get a list of the lights in the scene
lightList = GameLogic.getCurrentScene().getLightList()
# get the light named light1
light = lightList["OBLight1"]
# make it a lamp
light.type = light.NORMAL
# check for lamp
if light.type == light.NORMAL:
print "Reading by
lamp light"
SPOT
SPOT
Light source is a spotlight.
Sample Code
# get a list of the lights in the scene
lightList = GameLogic.getCurrentScene().getLightList()
# get the light named light1
light = lightList["OBLight1"]
# make it a spotlight
light.type = light.SPOT
# check for spotlight
if light.type == light.SPOT:
print "The spotlight
is on me."
SUN
SUN
Light source is a sun.
Sample Code
# get a list of the lights in the scene
lightList = GameLogic.getCurrentScene().getLightList()
# get the light named light1
light = lightList["OBLight1"]
# make it a sun
light.type = light.SUN
# check for Sun
if light.type == light.SUN:
print "Sunny days
are here"
|