How to offset the camera without it being all weird and jerky?

ericdg123ericdg123 Member, PRO Posts: 156
edited November -1 in Working with GS (Mac)
I've searched the forums and found nothing. I want to offset my main actor to the left side of the screen. So I make an invisibile actor and put the control camera in this actor. I then constrain the invisible camera actor to my main actors position plus 100 or so.

The problem is it makes my main actor super jerky and strange.

I've noticed this problem when constraining other actors positions too, but just putting the actor that the other actors are constrained to in the layer before the constrained actors it works ok.

It sucks becuse all my constrained actors such as wheels or whatever have to be in front of the actor they are constrained too, but it does work this way.

However trying this with the camera thing still does not work. I know it's possible but I just cant figure it out. Thanks.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi ericdg123, try the constraint the other way around, i.e constrain your player to the x,y of the invisible actor controlling the camera (minus 100 or so).

    :-)

    By the way, I asked what the inner box was for, a couple of weeks ago: it's the camera area, I realise now...doh!

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

  • hrsmediahrsmedia Member Posts: 522
    I'm still trying to figure this out too.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Wow, I'm invisible again! ;-)

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

  • hrsmediahrsmedia Member Posts: 522
    @gyroscope

    I tried your suggestion, same thing happens. I'm also trying to figure out how to make it work when the player rotates. The constrained actor does not stay to the front of the actor.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi hrsmedia; sorry for my cheekiness! I see what you mean; it worked in the first test of mine, though this was moving left, right, up and down, no probs. I tried it with a joystick control as well, and am getting duplicate behaviour OK too, (so both without jerkiness) although in this second test, the player does seem to catch up with the camera actor for some reason. (Plus if 1 collides and the other dosen't...) But certainly there's no problem with duplicating rotation of the camera actor. I think with a little more application to the prob, I could get it to work. Though I'm wondering what sort of controls you and ericdg123 are using for the camera actor; i.e screen buttons or joystick, for instance?

    Another consideration which will cause problems anyhow though, is collision. Enough said there...

    Of course, the ideal would be to be able to move the camera's origin as you know; but when or even if that's going to happen, I don't know. Sorry I can't be more helpful here. I could upload the tests, but as I say, until the collision problem is sorted, I think it's not worth proceeding with that style anyhow. Sorry to be so negative; hope I'm wrong...

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

  • ericdg123ericdg123 Member, PRO Posts: 156
    I can't constrain my actor to the camera box because my actor has collisions. It is a side scrolling racing game. I control my actor with a forward and reverse button and the collisions do the rest. But it doesnt matter if I'm pressing buttons or if I'm colliding or flying through the air. Its still jerky.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    ericdg123 said:
    I can't constrain my actor to the camera box because my actor has collisions.

    Thought as much (what game hasn't?!) So surely you must already have some "communication" between your player and the actor controlling the camera (not the other way around) when dealing with collisions? As the collisions that your main actor has are the important ones, it must be that way. So making full control of player actor controlling the camera actor is just the next step; it might cure your jerkiness prob.

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

  • hrsmediahrsmedia Member Posts: 522
    @gyroscope

    To move the actor I'm using accelerate on a button and left and right buttons rotating clockwise and counter clockwise.

    Edit: At the moment, i've abandoned the constrain and just made the actor smaller. Not a great solution...
    This should be a simple thing to do really. Just want enough space in front of the player at all angles...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi hrsmedia, glad you've come to some solution, even if it is a compromise.

    As for my previous post, I've "shot myself in the foot"!
    gyroscope said:
    So making full control of player actor controlling the camera actor...

    This is exactly what Eric is doing, and I see why now. I live and learn!

    One thing I would say, Eric, is constraining attributes is extremely processor intensive, as each one is constantly checking. So if you've quite a few, that's the reason for your game's jerkiness. So I guess your solution would be to somehow reduce the amount of constraints.

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

  • AfterBurnettAfterBurnett Member Posts: 3,474
    I'm still figuring out how to walk without being all weird and jerky...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    You haven't been smoking those funny cigarettes again, have you?

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

  • ericdg123ericdg123 Member, PRO Posts: 156
    gyro,

    I do have tons of constrains but this is not the problem as I'm still getting a good frame rate and I always check to see how much processor power every constrain pulls. When I put the camera controller in the main actor everything is as smooth as creamy peanut butter, but as soon as I put the camera control in a camera actor and constrain it, it turns to chunky peanut butter.

    mmmmmmm, peanut butter.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Not this morning.
  • contrasthallcontrasthall Member Posts: 131
    im having the same problem and im starting to think it may be because the position is not a solid number or i could come up with an invisible box for the actor to push through out the level as he moves right and vise versa when he moves left....im going to try it. hopefully works out.
  • ORBZORBZ Member Posts: 1,304
    i have a demo of this on my profile
Sign In or Register to comment.