Blender Game Engine Mouse Pointer



The 3D Cursor is simply a point in 3D space which can be used for a number of purposes.

Blender 3D 2.6 show mouse cursor in game engine the easy way.

  1. In this series of PDF tutorials I will show you, from start to finish how to make a fairly complex game in the Blender game engine. You will need to have a few Blender skills such as basic modelling, but I do give lots of info about every other aspect of making the game. At first your will be “plugging in” pre-written scripts to get your objects to perform correctly, but later I will be.
  2. I was making a game on blender and the cursor to select a location to create a object disappeared! I didn’t press any buttons on mistake, i didn’t change any weird settings, has this happened to anyone else!? I already tried remaking the game 3 times but its at the same point in the creation that the cursor disappears, and it is really hard to make, and finally each time i recreated.

Placement¶

There are a few methods to position the 3D cursor.

Direct Placement with the Mouse¶

Positioning the 3D cursor with two orthogonal views.

Using LMB in the 3D View will place the 3D cursor directly under your mouse pointer.

Blender Game Engine Vs Unity

Blender Game Engine Mouse Pointer

For accuracy you should use two perpendicular orthogonal 3D Views, i.e.any combination of top Numpad7, front Numpad1 and side Numpad3.That way you can control the positioning along two axes in one view and determine depth in the second view.

Game

Blender Game Engine Mouse Pointer Download

To place the 3D Cursor on the surface of geometry,enable Cursor Depth in the User Preferences.

See also

The Snap Menuwhich allows the cursor placement relative to scene objects.

Game

3D Cursor panel¶

Reference

Panel: Properties region ‣ 3D Cursor

The 3D cursor can also be positioned by editing the location coordinates values inthe 3D cursor panel of the Properties region.

Usage¶

The 3D Cursor is used as the origin for any added object, can be used and moved with thesnap tool, and is an option forthe pivot point.

NewsTutorialsGamesDownloadsLinksContact
Blender Game Engine Mouse Pointer

Featured Author:
-blendenzo-
Tutorials - Blender Game Engine by blendenzo, with special thanks to Social and Piraniac
Example file: customCursor.blend
Version Info: Blend made with 2.42a. Compatible with v2.34 and up.
Requirements: Basic knowledge of Blender GE interface and ability to 'plug in' a pre-written Python script
Helpful Knowledge: UV Mapping
Step 1 - Setup
Generally speaking, it is best to setup your custom cursor on an overlay scene (since it avoids potential problems related to camera movement). Begin by adding a new empty scene and naming it 'CursorOverlay'. Now add logic bricks in the main scene to intialize the overlay scene. I like to put this type of logic on the camera. Make sure you turn off 'Positive Pulse Mode' on the Always sensor.

Switch to the 'CursorOverlay' scene and add a camera. In the Edit context of the buttons panel [F9], set the camera's 'Clipping: Start' value to something larger. 15 should work.
In camera view [Numpad 0], add a new plane (this will cause the plane to be facing the camera). Move the plane about 20 blender units away from the camera and resize it to look good. You'll probably want to add a nice custom cursor texture at this point. Crosshairs should be centered on the plane. If you are using a pointer type cursor, make sure the point is at the top left corner of the plane.
Note: If you are using Blender Materials, there may be some strange lighting on the cursor. To fix this, assign a material to the cursor, set it to 'Shadeless' and give it a texture layer mapped to UV. Assign your cursor image to the texture layer.
Step 2 - Centering the Cursor (Pointer type cursors only. Crosshairs skip to step 3.)
Enter edit mode [Tab] on the plane and select the top left vertex. Press [Shift-S] over the 3D viewport and select 'Cursor to Selection' from the pop-up menu.

Now return to object mode [Tab] and go to the Edit context of the buttons window [F9]. Click 'Center Cursor'.
You should notice that the object center (represented by a pink dot) has moved to the upper left corner of the plane.

Step 3 - The Script (Social's Modified Version)
Copy this script and paste it into the Blender Text Editor (use [Ctrl+Shift+V] to paste from the system clipboard) or download it here. Name the script 'customCursor.py'
Step 4 - Logic Bricks
With the cursor selected, go to the Logic context of the buttons window [F4]. Add two sensors and one controller. Leave one of the sensors an 'Always', but make the second one a 'Mouse Over Any' and name it 'MousePosi'. Set the controller to 'Python' and set the script to 'customCursor.py'.
You will also need to add a property named 'init' and set it to a value of 1. (This is the property used by the script to center the mouse on the game screen at startup.)

Conclusion
It's that simple. Press 'P' and watch it work. You'll notice that the cursor follows the movement of the mouse precisely, regardless of window size or camera bounds. If necessary, resize your cursor to make it look good in game and your done.
Enjoy,
-blendenzo
Back to the tutorials index...


Website design by Tony 'blendenzo' DiRienzo. All content © Copyright Tony DiRienzo unless otherwise noted.