is there a script that sets the empty at mouse position
Every time you click , or on the first frame , or is the empty folowing the mouse ? what do you need?
I’ve been working on setting a cube at the mouse position on a left click (for use with a point/click control) -where the mouse hits a ground plane, so you need a ground plane for it to work. It should work with an empty instead of a mesh.
The following script should work
import GameLogic
import Rasterizer
# init stuff, show mouse
if not hasattr(GameLogic, 'init'):
GameLogic.init = 1
Rasterizer.showMouse(1)
# load controllers, get sensors, actuators, scene
g = GameLogic
s = GameLogic.getCurrentScene()
py = g.getCurrentController()
always,move,lmb,= py.sensors
# load objects
objList = s.getObjectList()
# choose cursor
cursor = objList["OBcursor"]
# find cursor
if move.positive:
pos = move.getHitPosition()
# with lmb click, place cursor
if lmb.positive:
cursor.setPosition(pos)
In the case of this script, OBcursor is my cube called cursor, so you’d have to name your empty ‘cursor’. Setup an always, mouse - move over & mouse - left click sensors linked to a python controller with this script on the ground plane.
Check out the thread for more details (http://blenderartists.org/forum/showthread.php?p=1474873#post1474873) - hope this helps.
thanks all