mouse cursor in game engine?

I am a newbie in game engine. I created a very simple scene and hit p to start the game, but I don´t see my mouse cursor!? Even if I start it as a runtime, as soon as I move the mouse over the game window, it disappears! (it reacts on the mouse click, however) Do I have to set the visibility somehow? I want to react on clicking on a certain object in my scene.

Any help greatly appreciated!

to add a mouse cursor you have to use a python script

import Rasterizer
 
Rasterizer.showMouse(1)

Or, more efficiently:


from Rasterizer import showMouse

showMouse(1)

To set this up, add a sensor (always, pulse mode off), and a python controller. Enter the name of your script in the provided field.

Here is an even shorter version:

import Rasterizer as r
r.showMouse(1)

Ha…three versions of the same script!

Well, thanks a lot! But how do I trigger this script at startup? If I copy that code in a text window and hit ALT-P it tells me “ImportError: No module named Rasterizer”. I have Python 2.4 installed. (using blender 2.42)

Use the python controller in the LogicBricks window. Connect an ‘always’ sensor to a python controller, and have the script be the one with the cursor code.

With Logic bricks:

|Always|-------------|Python|

That works, thank you all! But now I encounter another problem: I want to click on a certain object (actually a button) and if I click it should play an animation (change to “pressed” state). I added 2 sensors “Left button” and “Mouse over” to the object I want to animate (button) and linked them to an “AND” controller and that to a “play” actuator. That works! :wink:
but it also works on a certain area around that object!
How is the “mouse over” calculated? Does it calculate the exact geometry depend on the camera view?

I belive it’s calculated by the bounding geometry. Not 100% on that though.

post a .blend, and I’ll take a look at it

Actually, it is working now! I don´t know why…but thanks anyway!