B2.55 Mouse Movement for Mac fix - 3rd person shooter

I managed to collect some mouse movement and mouse look scripts to make my own script.

A perfect example of what my script does. http://www.youtube.com/watch?v=CgvPi3OJlZw

The mouse script can be adapted to be used in FPS to. But this one is solely for TPS.

I fixed a problem that I believe it was only happening on macs. Which was that the mouse started to stop in certain parts of the mouse movement. So I remembered from the classes that I had of game development and I spotted the problem. The resolution was to simply separate the rendering from the calculation, which was on the same script. It occurred that when you moved the mouse, bge.render.setMousePosition() was being accessed faster than object.applyMovement(), so the mouse sometimes stops a little bit from moving.

Now the script from mouse movement was split in two. One has all the calculations of size, application of movement from the mouse, and the other script has only the resetting mouse function, which is bge.render.setMousePosition(width/2,height/2) with a certain delay of access, which makes the entire mouse movement script to work on macs now! Finally! :stuck_out_tongue:

I attached the .blend. Hope everybody understands and if there is a way to tweak it more let me know! Because it is not entirely smooth mouse movement yet!

Thanks :slight_smile:

Attachments

Player_export255.blend (625 KB)

This should probably be in Blender Resources, but nice. Good job on solving the problem.

Run this blend file with blender player to see that there is a problem with the blender player and mouse look.(Win7)
I created a new thread about this problem…