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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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