Mouse detection for FPS game

hello all…

I come here again for guidance with mouse features for my FPS style game… Help is very appreciated as I am stuck and this is important feature to game!

First the bigger issue I would like to have solve, what is a good way to make parts of body match rotation of camera?

I am currently using mousemove script from as my mouse looking in first person, and it looks great. Problem is, my head and arms and such do not move up and down when I look up and down, so it looks wrong when I attempt to do realistic movement.

I was thinking… best thing to try and parent some how the camera to the rig head, but at same time… it wouldn’t work because camera would not follow movement.

Maybe, parent camera to rig, and mesh to camera? Thoughts on what to do?

Also a second question… to detect what the person is looking at (the center of the camera) is there a built in logic function for this with maybe mouse sensor or something? Or just create a wire frame long cylinder from the eyes that is parented to head, and when it collides with something it is considered looking at it? I am sure there is better/easier way?

thanks friends

Your head and arms should be the children of the camera.

You’ll have to use the Mouse > Mouse Over All sensor, and use a Python script to detect what the object is that you’re looking at.

thank you for your reply…

So head and arm bones are parented to camera, and camera will be parented to player mesh yes?

Okay see I knew there was some logic that could be used :). If I am correct Mouse Over Any will actually detect whatever the mouse if over in game, it just won’t have a cursor or anything yes?

thgen instead of python, could just have a Mouse Over sensor on any object interactable?


Mouse Over Any will detect if the mouse is hovering over ANY object. You COULD use a Mouse Over sensor on the specific object you want to detect, but if you want to get information for a lot of objects, it’s probably better to use a single Mouse Over Any sensor and use a Python script to get the object that’s CURRENTLY being targeted. (though if you’re not very versed in python, the first method will work.)

Also, it won’t have a cursor. If you want to have a cursor, there’s a great tutorial here that’ll teach you how to add one.

hello again, im sorry to rebump an old post, but I am still struggling with this…

mouseOver I have working 100% great.

following it with head rotation and hand rotation I am still having the hard time with. I understood what the original person who helped me said, but then now I try to actually do it and confusion hits.

In order to parent the camera to just the arms and the head, I would have to have to cut my rig into the two pieces and then parent one to the camera for rotation…? This is only way I see to do this, but at the same time it just intuativly seems wrong to me.

Please somebody clarify for me, so I can move on with my project!