"mouse over" sensor question

I know that there is a python command that gets the name of an object that crosses through a ray, but is there something like this for the “mouse over” sensor? I have a 3rd person shooting rig that changes to a 1st person camera when you hold the right mouse button. I want there to just be a cursor (crosshairs) to move on the screen (controlled by mouse movement) and get the name of whatever object it is over.

Thanks.

I think it’s still just,
hitobject = mouseover.getHitObject()

Ill try that. Thanks Jazz.

The Python documentation doesn’t list a “getHitObject()” for the mouseFocus sensor type. I recommend you parent an empty to the crosshairs then send out a ray from the empty and use that to determine what object is targeted.

The Python documentation doesn’t list a “getHitObject()” for the mouseFocus sensor type. I recommend you parent an empty to the crosshairs then send out a ray from the empty and use that to determine what object is targeted.

hmm make sure you take perspective into that thought, otherwise the ray from the empty will not hit the object that the crosshairs appear to be over.

Yeah, I finally got around to testing this and figured that out. Any other ideas?

Is it just me, or does the “mouse over/any” sensor no longer work?

I was using 2.44, and I couldn’t get it to activate anything. It’s almost as if the mouseray just cuts straight through the object, because when I used getRayTarget() it returned some extreme value for Z, even though it should have returned 0 (because looking down from top view, I had a plane covering as a ground object at 0,0).

Also using getHitPosition() crashes blender - in each and every instance of use.

Anyone else notice this?

Mouse over doesnt work for me, and Mouse over any crashes blender. I know nothing of programming, how are there new bugs with every version? Do developers start from scratch each time?

Well if that isn’t going to work correctly, maybe somebody can think of another way to do this. I am making a 3rd person shooter with a over-the-shoulder cam for more accurate aiming. I want there to be a crosshair controlled by the cursor, not a mouselook setup, but have it set up to where the camera stays still and the retical moves across the screen as your pointer is moving over your screen right now. Since you cant get the object name with a mouse over sensor (given that it worked correctly), I was thinking I could use a .getHitPosition() thing and have an empty that tracked to that spot and shot a ray to get the object name, but Social said that crashed blender.
Any other ideas?
Thanks

Please? Anyone? Some one? No one?

this file, while unrelated to your game in terms of gameplay, uses both mouse over any and mouse.getHitPosition, and works fine under 2.44 for me (well, at least the mouse part- it’s not finished though), so you can test if it’s 2.44 in general or just isolated cases.

(in the file, just click somewhere to set the waypoint. The cursor’s position is set via a mouse over any sensor and .getHitPosition)

Thank you very much Captain Oblivion. Thats exactly what I needed.

Sorry but i am getting a 404 error when I try to get the mouselook file. could you please post is somewhere else?
Wild_doogy

heh, I deleted that a while ago during one of my compulsive computer cleaning sessions. I might be able to dig it out of a backup…

[edit] the link should be good again, here it is if you don’t want to scroll up a bit… chances are it won’t remain here for too long, so get it while it’s fresh out of the oven

Social: I did encounter some of those problems as well, but I only used 2.44 for a a month or two. I haven’t been having any problems with the mouse over sensor in 2.45 though…

~~Stu