Recommended Posts

I finally finished writing the Phaser Arcade Circles plugin.

Plugin on GitHub:

https://github.com/VitaZheltyakov/phaser-arcade-circles-plugin

 

This plugin adds to framework:

  • Circle vs. Circle collision
  • Circle vs. Rectangle collision
  • Circle-body debug render

The plugin does not reduce the performance of arcade physics. The plugin is easy to use. It does not add new functions, but merely extends existing.

How to add a plugin:

Add to your index.html link to plugin file:

<script src="js/phaser-arcade-circles-plugin.js" type="text/javascript"></script>

How to use a plugin:

Then use the standard function setCircle for the circle-body.

sprite1.body.setCircle(radius, offsetX, offsetY);

Calculation of the collision produced as usual. No further use is not necessary functions.

Note:

  • Remember, this is an arcade physics. Not real physics. Therefore, some collisions may seem strange.
  • Remember, that the setCircle function overrides scaling and anchor point.

 

Examples:

The repository has 4 examples of using the plugin.

---

If Rachard read this post

Richard, I recommend you to add this functionality in the Phaser.

Share this post


Link to post
Share on other sites
13 hours ago, hexus said:

Sweet plugin!

As far as I'm aware, circle body support is being worked on already for newer versions. Check the branches of Phaser's Github repo.

Yes, it is being developed. I hope in the next version it will work.

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.