Circular Motion Help

Good day,

I’m really confused with the physics engine and I would really care for your help. I’m trying to develop a prototype game where a moving sprite (the player), once it reaches a defined distance from a certain static object, starts to rotates around that very object.

Initially, I had success by using a “pivot” joint between the “player” and the static physics object, but that solution is undesirable.

I would like to achieve the same circular motion by manually applying forces to the player. The only known attributes are the player’s and static object’s coordinates and the player’s current liner velocity.

Any help welcome :wink:

[import]uid: 84799 topic_id: 34011 reply_id: 334011[/import]

Take a look at setLinearVelocity(). If you know which direction the object should be travelling (this will require that you perform the orbital math yourself) you’ll be able to control the motion of the object. [import]uid: 8271 topic_id: 34011 reply_id: 135263[/import]

@horacebury : Thank’s for your reply. I will try. Do you have any suggestion for the math part - where should I look ;

Thanks [import]uid: 84799 topic_id: 34011 reply_id: 135265[/import]

Not for proper orbital math, but if you take a look at the current and next position of the object and simply change its velocity so that the next iteration takes it to the correct distance from the centre point you’ll have a reasonable approximation.

Other than that… stackoverflow. [import]uid: 8271 topic_id: 34011 reply_id: 135272[/import]

Take a look at setLinearVelocity(). If you know which direction the object should be travelling (this will require that you perform the orbital math yourself) you’ll be able to control the motion of the object. [import]uid: 8271 topic_id: 34011 reply_id: 135263[/import]

@horacebury : Thank’s for your reply. I will try. Do you have any suggestion for the math part - where should I look ;

Thanks [import]uid: 84799 topic_id: 34011 reply_id: 135265[/import]

Not for proper orbital math, but if you take a look at the current and next position of the object and simply change its velocity so that the next iteration takes it to the correct distance from the centre point you’ll have a reasonable approximation.

Other than that… stackoverflow. [import]uid: 8271 topic_id: 34011 reply_id: 135272[/import]