I'm using Cocos2d (version 3) and I want my hero sprite to be jostled around by incoming enemy sprites. The Chipmunk-based physics work, but I need some way to track the rotation of the sprite after a collision has ended. How do I do this? I tried sprite.rotation, etc.

  • \$\begingroup\$ I don't know Cocos2D, but don't you need to supply some angle value to even draw the sprite at that rotation? \$\endgroup\$ – Anko Apr 20 '14 at 22:10
  • \$\begingroup\$ No, you just add it to your layer. You can rotate programmatically but when Chipmunk, the Physics package takes over it's not clear. I think I need to use the textureRect before and after the collision but I haven't tried it yet. \$\endgroup\$ – batymahn Apr 21 '14 at 0:36
  • \$\begingroup\$ I'm trying to build a wheelchair simulation game and I need to know the forward angle of the sprite to apply the proper forward impulse to move forward. \$\endgroup\$ – batymahn Jun 29 '14 at 14:14
  • \$\begingroup\$ It always helps to let the application run before you return the angle --- LOL. \$\endgroup\$ – batymahn Jun 14 '15 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.