How do I work the 3d camera and add flying?

Not favoritedFavorited Favorited 0 favourites
  • 9 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • So I wanted to work on a game where you can fly around and maybe complete task but right now I'm stuck at the the camera. How would I make the camera follow the 3d object. Also I am definitely need help with the flying to.

  • You can probably get familiar with manipulating the 3d camera by looking at existing examples and just copying what they do.

    Flying could be as simple as just moving the player with an 8direction behavior and increasing the zelevation when a button is down, otherwise move it down.

    One possible following camera could be to consider the angle the player is moving, and position the camera some distance behind it and higher.

    Maybe use look at action

    Camera position: (player.x-200*cos(player.8direction.angleOfMotion), player.y-200*sin(player.8direction.angleOfMotion), player.zelevation+50)

    Look at: (player.x, player.y, player.zelevation)

    Up vector: (0,0,1)

    All that is vector math if you want to know what to google to expand your knowledge. You could make it smoother with some easing as well, which would simulate the camera man‘s delayed reaction of what the player does.

    It may also be useful to try similar ideas in just 2d to get the concepts down. 2d is way easier and construct provides a lot for you. Construct provides very little to assist with 3d stuff so you’ll end up needing to use a lot more math.

  • Thank you so much!

  • R0J0hound The 8 direction behavior wasn't working like I thought it would so I was started to make the movements manually but then it wasn't following the players direction do you think you can help?

  • If you’re moving manually I suppose that means you aren’t using a behavior and can’t use their angle of motion expression.

    If you manually move an object by changing its velocity you could calculate the angle of motion with:

    angle(0,0,velocityX,velocityY)

    If instead you move an object by changing an object’s position you can calculate it by saving the position to some variables, manually moving the sprite, then calculating the angle.

    1. Set oldx to sprite.x, set oldy to sprite.y

    2. Manually move sprite

    3. Set angle to angle(oldx,oldy,sprite.x,sprite.y)

    That’s useful for calculating an angle of motion no matter what you use.

    You could calculate a 3d orientation instead but I say it’s simpler to just fake it with 2d angles till you can’t.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound I'm so sorry but do I make like a global variable?

  • Yeah, any kind of variable should work. Global or instance for example.

  • R0J0hound Do you know how I can show you the game so far so you can help me because I now need a lot more help with stuff I don't understand?

  • Generally you’d upload the file somewhere and share a link, or share screenshots of events.

    Ideally that would allow you to get help from other users too since I’m not here too often.

    Depending on your level it might be easier for you to make a 2d version of what you had in mind first.

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