Im trying to use the mouse arrow to set the position of an empty (called ‘target’) in my simulation scene.
What Im doing:
- The following script is attached to a mouseover senesor on my object where I want the target empty to snap to.
GameLogic.target_pos = GameLogic.getCurrentController().getSensor(“mouse_ovr”).getRayTarget()
- The script below is attached to the ‘target’ empty which is supposed to snap to where the mouse is pointing.
GameLogic.getCurrentController().getOwner().setPosition(GameLogic…target _pos)
The problem:
The target empty does move but not to the exact position of the mouse. The camera that I am using is not fixed or looking down. It moves in a spherical motion - I think that this is the problem.
The getRayTarget() method works but sends [x,y,z] coordinates that don’t accurately relate to the position of where the hypothetical mouse ray is hitting.
If anyone has a solution I’d be very thankful.