Move the camera so its as if its breathing....is there a tidy way to do it?

StormyStudioStormyStudio United KingdomMember Posts: 3,989
edited November -1 in Working with GS (Mac)
Evening

Ok, next challenge, move the camera control so it is as if there is a breathing motion. say 25 pixels up over 3 seconds, then 25 down over 2 seconds.

I know I can do it with a couple of attributes, on, then move up, off, then move down. repeat with timers.

But I wondered if there was a more efficient way to do with the likes of sin() cos() etc....

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Anyone?
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    I guess no one knows. I will look into creating a figure of 8 movement and see how that works. I'm sure that's achievable with a bit of trigonometry .
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    interpolate the camera origin and use ease in and out?
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    thanks SciTunes...

    Just found the way I wanted...

    adapted a bit of maths from an old post of 'Orbs'

    add a 'move' behavior to my camera control (actor which controls camera move)

    Then chose the direction for the move, and then in speed put

    sin(game.Time*100)*100

    and played around with the numbers till it was what I was after

    sin(game.Time*60)*15

    nice smooth breathing motion, moving up and down and easing in and out at each end, all in one line of code...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Good one! :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.