Player Movement In A Circular Motion?

mallenmatt64mallenmatt64 Member, PRO Posts: 18

I'm working on an endless runner where I'm having the player actor rotate in a circular motion about an actor using constrained x and y values. This worked successfully in order to achieve the endless movement I'm looking for but now I'm wondering how I can move the player up and down in order to dodge obstacles, because with the x and y values constrained the move behavior doesn't seem to work any longer no matter the speed it is at.

I don't mind if I have to recreate it from the ground up but I essentially want to achieve a circular endless runner where the player moves the actor up and down to avoid obstacles while it's moving on this circular track, how would I achieve this?

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    A little more description might help.

    It sounds like you have 'actor A' sitting stationary. And you have 'actor B' circling around 'actor A'. You now want to move 'actor B' up and down?

    The easiest way to achieve that would be to move 'actor A' up and down. Then 'actor B' will continue to circle around 'actor A' and at the same time follow 'actor A' in its up and down motion.

  • mallenmatt64mallenmatt64 Member, PRO Posts: 18

    @RThurman said:
    A little more description might help.

    It sounds like you have 'actor A' sitting stationary. And you have 'actor B' circling around 'actor A'. You now want to move 'actor B' up and down?

    The easiest way to achieve that would be to move 'actor A' up and down. Then 'actor B' will continue to circle around 'actor A' and at the same time follow 'actor A' in its up and down motion.

    Thank you for your help. I tried achieving this but it doesn't seem to work however? When Object A moves up and down, Object B just simply continues its usual orbit.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @mallenmatt64 said:
    Thank you for your help. I tried achieving this but it doesn't seem to work however? When Object A moves up and down, Object B just simply continues its usual orbit.

    Hmmm... Then it is not really orbiting around Object A. My guess is that its orbiting around a point (an x,y coordinate) in the scene?

    If this is the case, you need to record the x,y positions of Object A and then then use those recorded x,y positions of Object A in the orbiting behavior of Object B.

    Attached is an example:

  • mallenmatt64mallenmatt64 Member, PRO Posts: 18

    @RThurman said:

    @mallenmatt64 said:
    Thank you for your help. I tried achieving this but it doesn't seem to work however? When Object A moves up and down, Object B just simply continues its usual orbit.

    Hmmm... Then it is not really orbiting around Object A. My guess is that its orbiting around a point (an x,y coordinate) in the scene?

    If this is the case, you need to record the x,y positions of Object A and then then use those recorded x,y positions of Object A in the orbiting behavior of Object B.

    Attached is an example:

    Sorry, but I currently don't have access to an OS X machine, could you possibly export that demo to Windows so I can look at the code? Thanks very much for your help.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Perhaps instead of up and down, you meant to have the actor move clockwise or counter clockwise. Here is another example where the actor moves both clockwise and counterclockwise, depending on which button you press.

  • mallenmatt64mallenmatt64 Member, PRO Posts: 18

    @RThurman said:
    Perhaps instead of up and down, you meant to have the actor move clockwise or counter clockwise. Here is another example where the actor moves both clockwise and counterclockwise, depending on which button you press.

    Sorry for taking so long to get back to you. I actually have sorted out the mechanics I think for moving the orbit's position up and down. I decided then rather than trying to move the actor up and down conventionally I'm interpolating the players distance from the Object B based on whether the buttons are pressed and it essentially achieves what I wanted. Now my main issue is that when I try to ad-hoc test my project or view it using the GameSalad viewer, the orbit is extremely unstable, the lag is almost unplayable. So now I'm wondering what could be causing this? It runs perfectly fine in a windows environment but something is causing it to be extremely CPU heavy on android. Thanks again for your help.

Sign In or Register to comment.