[Solved] Creating a new Camera that can rotate around the mouse

Im trying to create an overhead camera class that can be rotating by dragging the mouse while left clicking but otherwise stays static at its position



Unfortunately ive run in to some strange behaviour from the examples and my own code



I sucsessfully overrode a FlyCam which works for keys as I want it I can zoom in and out but not move the camera position around but there are no rotations of any kind involving mouse input



When you implement SimpleApplication you automatically get a flyCam which can rotate using the mouse but I cant find the code that is doing this anywhere its not in flyCam as far as I can tell



Basically I want to override FlyCam and make sure it can only rotate when the mouse is clicked but so far the only place I can find code that rotates with the mouse is in ChaseCam



Ive tried stripping this code out and adding it to my own but its getting extremely complex for something that should be quite simple



So my question is is overriding FlyCam a dead end or does anyone know where the mouse code for rotating is? other than the ChaseCam version



Thanks everyone :slight_smile:

There is a method called setDragToRotate(boolean) on the flyCam object. Try set it to true :slight_smile:

So my question is is overriding FlyCam a dead end or does anyone know where the mouse code for rotating is? other than the ChaseCam version


Thanks for your reply setting dragtoRotate did not work for me when i tried it and i couldnt find the mouse code at the time
I ended up copying the mouse motion part of ChaseCam and modifying it to call FlyCams rotateCamera method which now seems to work

Thanks