Jump to content

How to keep child sprite from rotating with parent p2 body?


tidelake
 Share

Recommended Posts

I need the child sprites not  to rotate/pivot with the cue.body, while I need the cue.body to rotate. How can I do this?   

 

    wave_left = cue.addChild(game.make.sprite(-ball_radius, 0, 'wave'))
    wave_left.angle = 270;
    wave_left.anchor.setTo(0.5, -2);

 

Screen Shot 2016-05-01 at 5.53.18 PM.png

Link to comment
Share on other sites

I don't think it's directly possible, as the parent sprite works as a display group and applies it's transformation on all it's children. You could however negate the effect by either:

  1. Not adding it as a child, but instead set the x/y of the child to the same as wave_left each frame and then have them in the same display group.
  2. Negate the rotation by setting the childs rotation to the negative of the parent and then displace with a vector from child to parent, but the first solution seems easier
  3. Wait for a better answer, there might be a built in way of doing this.
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...