HELP... snap to circle, and rotate around it ?!

POMPOM Member Posts: 2,599
edited November -1 in Working with GS (Mac)
Hello guys im having a bit of a problem with my new project,
What im trying to do is:

i have an actor "player" and in a specific event this actor snap to a "ball" actor and start rotating around it in a constant circular pattern (like the moon around earth in 2D)
i use the example in the site " How do I make an actor move in a perfect circle? " and i'v put 2 constrains
X = r*cos(t*c)+X0

Y = r*sin(t*c)+Y0

And it works fine.. but the problem is, i want my actor to start the rotation from the impact location,
instead it jumps to a random location of the circle and starts the circle motion from there, (i guess because of the "self.time" attribute )

How can i set an offset so that my "player" actor collide with "ball" actor and start Circiling around it - startin from the impact location ?

Please help

Roy.

Comments

  • POMPOM Member Posts: 2,599
    Help please ...
  • simo103simo103 Member, PRO Posts: 1,331
    not sure what help I can be ... but wanted to try (at least it will keep the thread fresh).

    Do you know how random it is when the actor jumps to a location on the circle? IE: is a certain collision spot always jumping to the exact same position

    ie: if you knew the x,y of the collision and knew the jump position x,y then you might be able to apply that knowledge to the equation.
  • frariofrario Member Posts: 164
    To reset self.time, destroy and recreate the actor on collide, and sum time with the current position (maybe calculating angle and converting to periodic?). I'll try to be more precise later
  • POMPOM Member Posts: 2,599
    First, thank you for trying to help.

    let me explain the issue in more detail:
    image

    A - the actor "player" accelerate toward the "black ball"

    B- actor "player" rotate around "black ball"

    it woks, its just that the snap is not fluid, the second the red "actor" hits the "black ball" it STARTS rotating around it from a random position of the perimeter , i want it to START the rotation from the impact location..

    Im almost sure it has something to do with math and offset..

    @frario
    reset the time will make its start from a specific permanent position every time, (lower right when i tested it)
    but in my case the impact location is unknown till impact.

    @simo103
    it is random , i can make it not random if i make an attribute
    called "time-1" and in impact i change it to "self.time" -1
    and in the equation i add :

    X = r*cos((t-"time-1")*c)+X0

    so it counts 0...1...2....3 so the start of the rotation is allways the same , now that we have this , how do we add the offset of the impact?
  • frariofrario Member Posts: 164
    Yes, it will be resetted to zero. But when they collide, you can store the vectortoangle and convert it to your angular shift, so it will stay in the same position. And the time starts running again!
  • POMPOM Member Posts: 2,599
    Does ORBZ still around?!
  • zapposhzapposh Member Posts: 65
    I know this post is not hot anymore, but I have exactly the same problem.

    I have all the equations in place, and I have the VectorToAngle extraction on collision. How to I use the value of this extraction in the X = r*cos(t*c)+X0 and Y = r*sin(t*c)+Y0 equations so that the rotation starts in the impact position? Has anyone solved the above?

    Thanks
Sign In or Register to comment.