what controls the FOV shifting on the 3D camera

1 favourites
  • 14 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • So I'm trying to create a mario kart type of game, but I'm having difficulty getting the camera to do exactly what I want. It keeps zooming in and out, and looking up and down slightly. That might be nice for some people, but I don't need that. I just want it statically looking behind the player. What parameter for the 3D camera controls this? The camera code is imported from the Ghost Racer template.

  • I’m unfamiliar with that template but would this work?

    construct.net/en/forum/construct-3/how-do-i-8/anybody-know-something-this-173033

    It positions the camera a bit behind the player and looks at a bit in front of the player. I adjusted it so that the player is on the bottom of the screen but you can tweak it more.

  • thanks for the fast reply! It works well, but it does need a bit of tweaking like you said. Regardless, Thanks!

  • another quick question; doesn't really belong here but may as well continue the discussion; What would I do if I wanted to have the camera shift angles veeerry slightly when the character turns, just so you can see slightly where you're turning before hand. I don't exactly know how to wield the rotate camera action yet.

  • To do the tilt you can change the up x/y/z with the look at action. Simplest way to change it is to use spherical coordinates. By default the tilt should be -90 (or was it 90?) and you’d add the angular speed to that. I don’t know if the car behavior can give you that but you can calculate a signed angle difference with the previous frame to get that.

    Here is basically what you’d do. With variables to calculate the steps.

    Diff = car.angle-prevAngle
    PrevAngle = car.angle
    Factor = 1
    Tilt = -90+Factor*angle(0,0,cos(diff),sin(diff))
    Up X = sin(tilt)*cos(car.angle)
    Up Y = sin(tilt)*sin(car.angle)
    Up Z = cos(tilt)

    If the view is upside down, replace -90 with 90. If it tilts the wrong way, make factor be negative. You can change the value of factor to make it tilt more or less.

  • To do the tilt you can change the up x/y/z with the look at action. Simplest way to change it is to use spherical coordinates. By default the tilt should be -90 (or was it 90?) and you’d add the angular speed to that. I don’t know if the car behavior can give you that but you can calculate a signed angle difference with the previous frame to get that.

    Here is basically what you’d do. With variables to calculate the steps.

    Diff = car.angle-prevAngle
    PrevAngle = car.angle
    Factor = 1
    Tilt = -90+Factor*angle(0,0,cos(diff),sin(diff))
    Up X = sin(tilt)*cos(car.angle)
    Up Y = sin(tilt)*sin(car.angle)
    Up Z = cos(tilt)

    If the view is upside down, replace -90 with 90. If it tilts the wrong way, make factor be negative. You can change the value of factor to make it tilt more or less.

    would I put this in a snippet or in a full file?

  • It’s mostly a guide on how to do it.

    You’d add variables named diff, prevAngle, factor and tilt. Then in an every tick event you’d set those variables (a=2 would be the same as “set a to 2”). The up x/y/z are the expressions you’d use in the 3d camera look at action.

  • The camera is now flopping around, it's rotating 360 degrees and i'm not making any progress through troubleshooting. What I have is this:

    https://dl.dropboxusercontent.com/s/jmz49tj59mffc8p/test.c3p

    can you explain what i'm doing wrong?

  • You’re using wrong values when you set the factor and tilt variables. It should be the same as what I wrote.

    Factor should be set to 1,

    And when setting the tilt you should use diff instead of angular speed.

  • it continues to flip upside-down. All I did was change the values back to what you said. What else can I do?

  • Looks like the camera.angle in the up calculations needed to be negative. Guess it pays to test. 3d math is hard to conceptualize.

    Anyways, did that and it worked but it was jarring when you stopped turning as it snapped back to not tilted. Added some easing to make it more gradual.

    dropbox.com/s/v52y3gxnckqv3nb/mode7like_with_tilting.c3p

  • did you already make the numbers negative on the template?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes. That link I posted is tested as working.

  • everything works. Thanks! Sorry for wasting your time lel.

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