Reputation: 17
I want to attach an actor to a rotated group .the group is rotated by (RotateBy Action)
I want the actor to be added to the group and seem as it is attached to circle surface of group like this game Orbitals Circles
or see video Game Video
Upvotes: 0
Views: 71
Reputation: 3146
Groups have their own coordinate systems, so when adding the child, you'll need to transform its coordinates from its previous group's coordinate system (probably the stage) to the new group's coordinate system.
There is a method on group that can help with this...
public Vector2 localToDescendantCoordinates (Actor descendant, Vector2 localCoords)
So, assuming the actor you want to add is currently on the stage (i.e. not in any group), you can work out the coordinates you want for the group using something like the following...
stage.getRoot().localToDescendantCoordinates(targetGroup, actorCoords)
Where stage
is your stage, targetGroup
is the group you want to add the actor to, and actorCoords
is a Vector2 representing the current position of the actor that you want to add.
Caveat: I've had to make a fair few assumptions here about your code.
Upvotes: 1