I am not sure why the camera spins at the xyz intersection, but wish someone could come to the rescue with some information on how to stop the spin, without changing the mouselook design. Maybe add to the script to stop the spin or an understanding of how the 3d world is mapped to be able to adjust either the world axis or camera elements.
I’m not sure if you meant that the camera moves even when the mouse isn’t moving, but that is the problem I had. The only way to fix that wold be to set the Track To Actuator’s time to 0, but that results in a very fast movement system. I don’t know why you need to keep this system, but I have a script that may make your life easier:
In the next post.
http://riyuzakisan.weebly.com/mousemove-script.html
This script will make your life a lot easier. This is commonly regarded as BGE’s closest thing to mouselook, and is even posted on the Blender addon page. There is a problem which I commonly run into is that you have to be careful how you parent your camera to your object, as it may cause sporadic flipping around on the axis, which, while it sounds hilarious, makes things difficult when you’re trying to get anything done.
This is because he saw that his script had the same issue here, he needed to prevent it from spinning on certain axis, so he forced it into one axis. If you look in the code, I’m sure you can fix it for him using a constraint or something.
Download the file, run and you will see that the script, logic bricks and the camera plus other objects allows for a different mouselook. If you tilt upwards or downwards you will reach the point where convergence of the axis occurs or it could be certain coordinates of the mapping of the 3D world that cause the spin that I refer to in my opening statement. It would seem to me, that seeing that the camera is actually following a 3D set of coordinates, that it would have to be the mapping of the world coordinates that is causing it to rotate at the far z axis in combination with the x and y being brought together after passing the z axis in the direction you go(either upwards or downwards). Which leads me to the options of changing the world coordinate mapping, add in another object, add to the script or even add a constraint that would allow for complete 360 rotation on any axis, that would work as long as the cameralook was the same. I was hoping for someone who may just see a quick easy way of doing just that by adding to what was existing.
Sometimes, you can’t just patch your way into a working solution if the approach isn’t very good to begin with. Though in this case, my guess is that you either see the numbers go from negative to positive and you haven’t properly accounted for it or your ‘mouseray’ is suddenly reporting misses (not hitting anything) which results in the last line throwing an error.
I think this behavior falls out naturally from the math involved in aligning one axis to a specific vector (which is the primary function of the TrackTo actuator); The remaining axes have to be derived, and in this process, the results vary wildly when alignment is near Z or -Z.
In general, I would agree with what others have already said:
You should use one of the existing mouselook scripts, or you should write one yourself (you could use my mouselook tutorial as a starting point).
Thanks every one! I had no idea that the track to aligned an axis to a vector. I really must learn more about the modules and functions of the BGE.
@ Goran: I tried your mouselook script and the problem was when flipping over in local coordinates that the view turns upside down and the movement of the mouse reverses. I also tried riyuzakisans script also, but the problem was the same when flipping over. I need to do more in depth study to understand the inner workings of the modules and then I may have a chance at making this work.
BPR; The use of torque would require some special handling because otherwise you would get the impression that the camera is drunk (coasting to a stop or not being too responsive).
Torque has a number of uses in physics-based mechanics, but it shouldn’t be used for everything.
wait guys so there is a mouse move script and a mouse look
i remember on blender 2.4 the mouse look never used to work
but on blender 2.6 the mouse move works perfectly iam not sure
about the mouse look on blender 2.69