How do I orbit the 3D Camera around an object using X Z axis?

0 favourites
  • 3 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hello,

    I hope my explanation makes sense...

    I'm trying to calculate the x and z position of the 3d camera in order to orbit round the middle of my layout, always facing the center of the layout at a z position of 0.

    ranges are

    x: -100 to LayoutWidth +100

    z: -100 to 100

    If we pretend the layout+100 is 2000 wide for the sake of simplicity, the following should be true for each quarter of the orbit:

    x z desc

    ---------------------

    0 0 Cam pos is far left and layout middle (edge on looking right)

    1000 100 Cam pos is front and center of the layout

    2000 0 Cam pos is far right (edge on looking left)

    -1000 -100 Cam post is rear center looking in from the back

    At the moment I've been incrementing and decrementing values to try and do this, and the result is more like ping pong than an orbit (example project https://www.dropbox.com/s/64dgaklczg96eu3/3dOrbit.c3p?dl=0).

    I'm sure theres a nice calculation that can make this work nicely and produce a smooth constant orbit, but so far I haven't worked it out; my math muscles are in need of some exercise.

    I've also looked at orbit and rotation behaviours to try and solve this, but they only rotate round the xy axis and not the z; which is important to me.

    Any help would be appreciated.

    Tagged:

  • I remember seeing this video a few weeks back: https://www.youtube.com/watch?v=MCGELH9kPJ4

    this might be a overly complicated version of what you want, but should get you there.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the info fedeca, much appreciated.

    It does look somewhat complex; I shall digest and share my results once I've got somewhere.

    Regards,

    Al

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)