Home | Trees | Indices | Help |
|
---|
|
Documentation for the Rasterizer module.
Example Uses an SCA_MouseSensor, and two KX_ObjectActuators to implement MouseLook:
# 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)
Functions | |||
list [x, y] |
|
||
3d vector |
|
||
KX_GameObject |
|
||
integer |
|
||
integer |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
float |
|
||
|
|||
float |
|
||
|
|||
KX_TEXFACE_MATERIAL, KX_BLENDER_MULTITEX_MATERIAL, KX_BLENDER_GLSL_MATERIAL |
|
||
|
|||
boolean |
|
||
|
Function Details |
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 = Rasterizer.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 = Rasterizer.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 = Rasterizer.getScreenRay(0.5,0.5,100,"wall")
|
Writes a screenshot to the given filename. If filename starts with // the image will be saved relative to the current directory. If the filename contains # it will be replaced with the frame number. The standalone player saves .png files. It does not support colour space conversion or gamma correction. When run from Blender, makeScreenshot supports Iris, IrisZ, TGA, Raw TGA, PNG, HamX, and Jpeg. Gamma, Colourspace conversion and Jpeg compression are taken from the Render settings panels.
|
Enables or disables the operating system mouse cursor.
|
Sets the mouse cursor position.
|
Sets the window background colour.
|
Sets the mist colour.
|
Sets the mist start value. Objects further away than start will have mist applied to them.
|
Sets the mist end value. Objects further away from this will be coloured solid with the colour set by setMistColor().
|
Sets the eye separation for stereo mode.
|
Sets the focal length for stereo mode.
|
Set the material mode to use for OpenGL rendering.
Note: Changes will only affect newly created scenes. |
Enables or disables a GLSL material setting.
|
Get the state of a GLSL material setting.
|
Draw a line in the 3D scene.
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Fri Apr 24 17:51:18 2009 | http://epydoc.sourceforge.net |