playMaker

Author Topic: RTS camera rotation  (Read 2588 times)

santelia

  • Junior Playmaker
  • **
  • Posts: 78
RTS camera rotation
« on: July 04, 2012, 10:58:42 AM »
I have to find out a reliable and smooth way to rotate the camera of a typical RTS game.
Zoom and fw-bw-left-right already run: using getAxis Mouse ScrollWheel for the first, and get key down with the four arrows for the rest.
But as far as the camera rotation is concerned, I'm facing a more challenging problem.
The best user interaction would be to get when mousewheel/mouse-centerbutton is pressed, and from then (while it's still pressed) rotate the camera Y axis (world) accordingly with mouse movement (delta right and delta left) until mousewheel/mouse-centerbutton is released.
Any help for that is surely VERY VERY MUCH appreciated ;-)
« Last Edit: July 04, 2012, 11:46:42 AM by santelia »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: RTS camera rotation
« Reply #1 on: July 05, 2012, 03:26:57 AM »
Hi,

 Have you checked existing camera work frameWorks on the asset store? Touch.Inputs has some very useful and solid camera systems for example.

Doing it yourself means the following: you have to cut down the feature in the hierarchy, have the camera attached to a dummy, in turn attached to another dummy. The first dummy move the whole thing around, the second dummy rotates and the camera zoom in and out. This way nothing gets in the way.

 CAMERA PLATFORM
     CAMERA ROTATION
        CAMERA

does that make sense? so as you catch user input like you describe, you would only rotate  "CAMERA ROTATION"

This means in your case that you can really separate the logic behind checking user input as well.

 bye,

 Jean

santelia

  • Junior Playmaker
  • **
  • Posts: 78
Re: RTS camera rotation
« Reply #2 on: July 05, 2012, 04:35:58 AM »
Thank you Jean, I was already moving on that way. Only I was wondering if any other great solution was in the air. Guess for now I'll continue like that.