- Home /
Unity mouse trackball? (i guess it is called that) (c#)
This will be a bit hard to explain but i will try. I played an indie arcade flight sim the other day called "Battle of Endor" and you could easily move your view without moving the mouse too much.
This is because it had a really smart kind of mouse control.
Lets say that your mouse is in the center of the mousepad. Then you move you mouse to the right. The ship would turn to the right until you centered the mouse again. If you moved your mouse slightly to the right, your ship would slighty turn to the right until you move it to the right even more or move your mouse to the center.
Well i hope my explanation was understandable. Now here is the real question; How to achieve this in Unity (specifically in c#) ?
Answer by Jamora · Jul 27, 2013 at 08:03 PM
As Unity Answers isn't here to script for you, I won't give you ready code.
What you need to do is have a dead zone (a circle few pixels in diameter) where the ship remains centered and stable. As soon as the cursor moves out of this dead zone, you calculate how far it has moved relative to the dead zone and adjust your ship accordingly. You can limit how much the player can maneuver by making a larger circle, that the cursor cannot escape.
You'll need Screen.showCursor.
I have no idea of how i should get started (script-wise) but thanks for clarifying this to me.
Back to learning more c# it seems :D
Your answer
Follow this Question
Related Questions
Spacesim character controller 2 Answers
How can i control force on a mouse look? 1 Answer
Returning Force/Direction to zero 0 Answers
Mouselook in space, without a 'down' or 'up' 1 Answer
Lighting and textures in a Space Sim 1 Answer