playMaker

Author Topic: Mouse Controlled Camera Rotation Around an Object  (Read 2167 times)

HyperExc

  • Playmaker Newbie
  • *
  • Posts: 21
Mouse Controlled Camera Rotation Around an Object
« on: July 22, 2015, 03:32:56 PM »
Hey, guys!

I'm having a 3D scene where I would like to rotate a Camera around an object (around the Y axis) when I click and drag the mouse left and right on the "background" (anywhere else except on the object itself).

I've partially succeeded in doing so by parenting the Camera to an Empty Game Object called "Anchor" which is the target the Camera should always look at. I used the Drag Camera Action on an empty game object and selected the Main Camera. I then tried the different follow, look at, and look at object actions on the Camera, selecting the Anchor in the menu and I got the best result with the Look At 2 Action.

The problem is that the camera rotates exactly as I want it around the object, but only to a small degree. If I continue dragging the mouse, the Camera starts to roll off into the distance, although it still looks at the object, but it never rotates around it.

Any ideas on how to fix this? Thanks. :)
« Last Edit: July 22, 2015, 03:36:26 PM by HyperExc »

phannDOTde

  • Full Member
  • ***
  • Posts: 237
    • Peter Hann .de
Re: Mouse Controlled Camera Rotation Around an Object
« Reply #1 on: July 31, 2015, 08:48:42 AM »
first guess: make a helper object at your focus point, set the camera you want to turn around as a child of the helper and then rotate the helper object. you can un-child the camera on button released or something if needed

HyperExc

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Mouse Controlled Camera Rotation Around an Object
« Reply #2 on: September 10, 2015, 04:58:39 AM »
Thanks! I got it to work! Cheers! :)