| Trees | Indices | Help |
|
|---|
|
|
PyObjectPlus --+
|
CValue --+
|
SCA_IObject --+
|
KX_GameObject --+
|
KX_Camera
|
|||
|
|||
|
|||
| boolean |
|
||
| matrix (4x4 list) |
|
||
| matrix (4x4 list) |
|
||
|
|||
|
|||
| list [x, y] |
|
||
| 3d vector |
|
||
| KX_GameObject |
|
||
| Deprecated | |||
|---|---|---|---|
| matrix (4x4 list) |
|
||
|
|||
|
|||
| Property Access | |||
| Inherited from KX_GameObject | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| list [vx, vy, vz] |
|
||
| 3d vector. |
|
||
| float |
|
||
| list [vx, vy, vz] |
|
||
|
|||
| list [fx, fy, fz] |
|
||
| 3-tuple (float, 3-tuple (x,y,z), 3-tuple (x,y,z)) |
|
||
| list [vx, vy, vz] |
|
||
| 3-tuple (KX_GameObject, 3-tuple (x,y,z), 3-tuple (nx,ny,nz)) or 4-tuple (KX_GameObject, 3-tuple (x,y,z), 3-tuple (nx,ny,nz), KX_PolyProxy) |
|
||
| KX_GameObject |
|
||
| boolean |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| CListValue of KX_GameObject |
|
||
| CListValue of KX_GameObject |
|
||
| float |
|
||
| KX_MeshProxy |
|
||
| 3x3 rotation matrix |
|
||
| KX_GameObject |
|
||
| list [x, y, z] |
|
||
| int |
|
||
| boolean |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
| list |
|
||
| boolean |
|
||
| Inherited from CValue | |||
| string |
|
||
| Inherited from PyObjectPlus | |||
| bool |
|
||
|
|||
| 4x4 Matrix [[float]] |
camera_to_world This camera's camera to world transform. |
||
| float |
far The camera's far clip distance. |
||
| boolean |
frustum_culling True if this camera is frustum culling. |
||
| float |
lens The camera's lens value. |
||
| 4x4 Matrix [[float]] |
modelview_matrix This camera's 4x4 model view matrix. |
||
| float |
near The camera's near clip distance. |
||
| boolean |
perspective True if this camera has a perspective transform, False for an orthographic projection. |
||
| 4x4 Matrix [[float]] |
projection_matrix This camera's 4x4 projection matrix. |
||
| bool |
useViewport True when the camera is used as a viewport, set True to enable a viewport for this camera. |
||
| 4x4 Matrix [[float]] |
world_to_camera This camera's world to camera transform. |
||
| Constants | |||
|---|---|---|---|
|
INSIDE see sphereInsideFrustum() and boxInsideFrustum() |
|||
|
INTERSECT see sphereInsideFrustum() and boxInsideFrustum() |
|||
|
OUTSIDE see sphereInsideFrustum() and boxInsideFrustum() |
|||
| Property Access | |||
| Inherited from KX_GameObject | |||
| list |
actuators a list of SCA_IActuator with string/index lookups and iterator support. |
||
| CListValue of KX_GameObject's |
children direct children of this object, (read-only). |
||
| CListValue of KX_GameObject's |
childrenRecursive all children of this object including childrens children, (read-only). |
||
| list of SCA_ISensor. |
controllers a sequence of SCA_IController objects with string/index lookups and iterator support. |
||
| float |
linVelocityMax Clamp the maximum linear velocity to prevent objects moving beyond a set speed. |
||
| float |
linVelocityMin Enforces the object keeps moving at a minimum velocity. |
||
| list [ix, iy, iz] |
localInertia the object's inertia vector in local coordinates. |
||
| 3x3 Matrix [[float]] |
localOrientation The object's local orientation. |
||
| list [x, y, z] |
localPosition The object's local position. |
||
| list [sx, sy, sz] |
localScale The object's local scaling factor. |
||
| float |
mass The object's mass |
||
| list of KX_MeshProxy |
meshes a list meshes for this object. |
||
| string |
name The name of this CValue derived object (read-only). |
||
| boolean |
occlusion occlusion capability flag. |
||
| 3x3 Matrix [[float]] On write: local orientation, on read: world orientation |
orientation The object's orientation. |
||
| KX_GameObject or None |
parent The object's parent object. |
||
| list [x, y, z] On write: local position, on read: world position |
position The object's position. |
||
| list [sx, sy, sz] On write: local scaling, on read: world scaling |
scaling The object's scaling factor. |
||
| list |
sensors a sequence of SCA_ISensor objects with string/index lookups and iterator support. |
||
| int |
state the game object's state bitmask, using the first 30 bits, one bit must always be set. |
||
| float |
timeOffset adjust the slowparent delay at runtime. |
||
| boolean |
visible visibility flag. |
||
| 3x3 Matrix [[float]] |
worldOrientation The object's world orientation. |
||
| list [x, y, z] |
worldPosition The object's world position. |
||
| list [sx, sy, sz] |
worldScale The object's world scaling factor. |
||
| dict |
attrDict get the objects internal python attribute dictionary for direct (faster) access. |
||
| Inherited from PyObjectPlus | |||
| bool |
invalid Test if the object has been freed by the game engine and is no longer valid. |
||
|
|||
Note: when the camera is first initialized the result will be invalid because the projection matrix has not been set. |
Tests the given box against the view frustum. Example:
import GameLogic
co = GameLogic.getCurrentController()
cam = co.owner
# Box to test...
box = []
box.append([-1.0, -1.0, -1.0])
box.append([-1.0, -1.0, 1.0])
box.append([-1.0, 1.0, -1.0])
box.append([-1.0, 1.0, 1.0])
box.append([ 1.0, -1.0, -1.0])
box.append([ 1.0, -1.0, 1.0])
box.append([ 1.0, 1.0, -1.0])
box.append([ 1.0, 1.0, 1.0])
if (cam.boxInsideFrustum(box) != cam.OUTSIDE):
# Box is inside/intersects frustum !
# Do something useful !
else:
# Box is outside the frustum !
Note: when the camera is first initialized the result will be invalid because the projection matrix has not been set. |
Tests the given point against the view frustum. Example:
import GameLogic
co = GameLogic.getCurrentController()
cam = co.owner
# Test point [0.0, 0.0, 0.0]
if (cam.pointInsideFrustum([0.0, 0.0, 0.0])):
# Point is inside frustum !
# Do something useful !
else:
# Box is outside the frustum !
Note: when the camera is first initialized the result will be invalid because the projection matrix has not been set. |
|
Returns the world-to-camera transform. This returns the inverse matrix of getCameraToWorld().
|
Deprecated: Use the projection_matrix attribute instead. |
Sets the camera's projection matrix. You should use normalised device coordinates for the clipping planes: left = -1.0, right = 1.0, top = 1.0, bottom = -1.0, near = cam.near, far = cam.far Example:
import GameLogic
def Scale(matrix, size):
for y in range(4):
for x in range(4):
matrix[y][x] = matrix[y][x] * size[y]
return matrix
# Generate a perspective projection matrix
def Perspective(cam):
return [[cam.near, 0.0 , 0.0 , 0.0 ],
[0.0 , cam.near, 0.0 , 0.0 ],
[0.0 , 0.0 , -(cam.far+cam.near)/(cam.far-cam.near), -2.0*cam.far*cam.near/(cam.far - cam.near)],
[0.0 , 0.0 , -1.0 , 0.0 ]]
# Generate an orthographic projection matrix
# You will need to scale the camera
def Orthographic(cam):
return [[1.0/cam.scaling[0], 0.0 , 0.0 , 0.0 ],
[0.0 , 1.0/cam.scaling[1], 0.0 , 0.0 ],
[0.0 , 0.0 , -2.0/(cam.far-cam.near), -(cam.far+cam.near)/(cam.far-cam.near)],
[0.0 , 0.0 , 0.0 , 1.0 ]]
# Generate an isometric projection matrix
def Isometric(cam):
return Scale([[0.707, 0.0 , 0.707, 0.0],
[0.408, 0.816,-0.408, 0.0],
[0.0 , 0.0 , 0.0 , 0.0],
[0.0 , 0.0 , 0.0 , 1.0]],
[1.0/cam.scaling[0], 1.0/cam.scaling[1], 1.0/cam.scaling[2], 1.0])
co = GameLogic.getCurrentController()
cam = co.owner
cam.setProjectionMatrix(Perspective(cam)))
Deprecated: Use the projection_matrix attribute instead. |
Deprecated: Use the useViewport attribute instead. |
Sets the region of this viewport on the screen in pixels. Use Rasterizer.getWindowHeight Rasterizer.getWindowWidth to calculate values relative to the entire display. |
Gets the position of an object projected on screen space. Example: # For an object in the middle of the screen, coord = [0.5,0.5] coord = camera.getScreenPosition(object)
|
Gets the vector from the camera position in the screen coordinate direction. Example: # Gets the vector of the camera front direction: m_vect = camera.getScreenVect(0.5,0.5)
|
Look towards a screen coordinate (x,y) and find first object hit within dist that matches prop. The ray is similar to KX_GameObject->rayCastTo. Example: # Gets an object with a property "wall" in front of the camera within a distance of 100: target = camera.getScreenRay(0.5,0.5,100,"wall")
|
|
|||
camera_to_worldThis camera's camera to world transform. (read-only) Regenerated every frame from the camera's position and orientation.
|
modelview_matrixThis camera's 4x4 model view matrix. (read-only) Regenerated every frame from the camera's position and orientation.
|
world_to_cameraThis camera's world to camera transform. (read-only) Regenerated every frame from the camera's position and orientation. This is camera_to_world inverted.
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0beta1 on Wed Aug 26 12:07:40 2009 | http://epydoc.sourceforge.net |