Blender 3D: Noob to Pro/Basic mouse pointer

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Mouse Pointer[edit | edit source]

Making a simple mouse pointer in the game engine. This takes up a lot of resources but it is very simple.

A little Python is involved but it is very easy to use and is only 2 lines of code.

  1. Open up blender and split the screen in two.
  2. Make the right screen a text editor and add a new text file with ALT+N. Type in the following code.
    import Rasterizer as r
    r.showMouse(1)
    
  3. Set TX: showpointer in the middle of the Text panel menu bar.
  4. Select an object that will always be available - preferably a camera.
  5. Go to the logic tab, add a "Property" sensor, a "Python" controller, an "AND" controller and a "Property" actuator.
  6. Activate the True Level Triggering (the “‘ button), set Prop: switch and Value: 0. Connect the property sensor to the python and AND controllers by dragging lines between the bullets.
  7. For the python controller set Script: showpointer. Note: If the value keeps being reverted to blank after setting it, the name you entered is not a legal script name; chances are you did not set the name of your script correctly. Look for the selection menu beginning with "TX:" and make sure it says TX:showpointer.
  8. Now connect the AND controller to the property actuator. Set Prop: switch and Value: 1.
  9. Select Actor and click on Add Property make it a Int type and set Name:switch.

Now press P to start the game and now you`ll see your mouse pointer.