Jump to content

How to animate/show physics joints (spring, rope, etc) without debug? Want to animate these joints with particle effects or spritesheet


tonky
 Share

Recommended Posts

I am making a game that uses physics joints (can be p2 but for this I am using box2d joints). Currently, I am showing the joints using debug but I would like to polish the joint and use either a spritesheet or particles. Has anyone got any pointers for this? 

Link to comment
Share on other sites

Hi, do not use anything related to debug in your final game. Debug features are only for development and can have really significant performance hits if you leave it in release...

For (non-debug) showing joints in game you will have to create some system, that will draw it for you independently on debug features. You can check source for ways how debug draws it and repeat it in your game with sprites or particles. For example: you can make small class that will paint sprite between two points and use it instead of line drawing (get two end points, calculate atan2 to get angle between them, calculate length of vector between them, set width of joint sprite to this length and its angle to calculated angle)

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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