I'm using this code to create my chase camera, stoled from FlagRush:
HashMap<String, Object> props = new HashMap<String, Object>();
props.put(ThirdPersonMouseLook.PROP_MAXASCENT, "" + 90 * FastMath.DEG_TO_RAD);
props.put(ChaseCamera.PROP_INITIALSPHERECOORDS, new Vector3f(5, 0, 30 * FastMath.DEG_TO_RAD));
chaser = new ChaseCamera(camera, player, props);
I like the smooth way it follow the char, but i dont like the way it moves with the mouse movemennt, 'cause i have elements on the screen that the user should click on.
So, ss it possible to desactivate this mouse movement or only activate it when the right mouse button is down (like on World of Warcraft)?
chaser.getThirdPersonMouseLook().setLookMouseButton( 1 );
I think that will do it for you. (0: left mouse, 1: right Mouse) I believe...
you might also need this:
MouseInput.get().setCursorVisible( true );
Here is a MouseAdapter I wrote for a little test app I made.
It it using the same mouse handling as the Unreal 3 Editor. When any mouse button or both mouse buttons are held down I hide and lock the mouse pointer until it is released again. This way I can move around in the scene when the buttons are pressed down and have a pointer when they aren't.
Here's the code so you can see how I did it. Tho this isn't really what you are looking for it atleast shows a way to switch between pointer and no pointer when writing your own mouse adapter
* Unreal 3 Editor
* @author Thomas
Basixs, wich version are you using?
Cause on the last version there's no such method getThirdPersonMouseLook.
Solved, the right code is:
Any way to then change the setting for the inverted look on the mouse? I can't stand it!
Dam, I didn't look into the forums for 2 weeks to help you with the "inverted thing" Problem above, you can change it with props.put(ThirdPersonMouseLook.PROP_INVERTEDY, "true");
- Though I guess you figured it out yourself already.
However I am working on something equal and now I am wondering if it's possible to zoom in and out more than the small zoom-step you can do in the flagrushtutorial: I already looked into the API finding some values like MAXDISTANCE or MAXROLLOUT and tried
props.put(ChaseCamera.PROP_MAXDISTANCE, "80"); //instead of "6"
etc. but none of them work! Anyone knows what I'm doing wrong here?
this works for my mouse wheel
Is there also any way to make the camera go up and down smoother? It seems that when I elevate or drop the camera, it snaps to a position. I can either be really high, or really low. I'd prefer it to be able to be smooth and allow multiple POVs
Thx prism! that worked. The distance was too less for me to realize it so that I only scrolled 1 time between MAX & MIN.
Also useful, because it makes the "zoom-steps "smaller":
@Trussel: I have the same problem if you mean that when using the mouse in ThirdPerson to look up & down it "snaps" somehow either too much up or too much down. Therefore it is not as comfortable as the FirstPersonMouseLook of the default Camera which is smooth in all directions.
I don't know exactly why but I guess this is because the Camera is bound to the "grid" of a Sphere and each time you get in between the grid it snaps to either the above or beyond gridline.
I'd also be happy if there is a solution to that.
Look at the Y multiplier I believe.
Thx renanse! That did the trick.
// Snapping greatly reduced
I also want to correct my "zoom movement"… it workes better with dividing from the default value than to set a random number in it…
// This slows down the zoom in-out movement
Same here. Thank you very much, I assume you're probably Joshua Slack since you know so much about the Chase Camera, so thank you Mr. Slack.
That worked quite well for me.
YOU can call me Sir Prism
Ah interesting your solution, Trussel, feels a bit better in the mouse-movement than mine. Though I don't know why that's the case. But I will adapt it, so thank you