HELP... snap to circle, and rotate around it ?!
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.
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
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.
let me explain the issue in more detail:
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?
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