Sign in to follow this  
Stephan

Basic physics extention

Recommended Posts

Hi guys,

 

I just released the beta version of my first panda.js plugin.

 

Download: https://github.com/stephan0v/Panda.js-physics-extention-plugin.

Live demo: http://vermeire.home.xs4all.nl/panda/

 

Panda.js physics extention plugin. This plugin adds several features to the built in basic physics engine of Panda.js.

 

Features:

  • Collision between squares and circles is now far more realisic and follows the laws of physics.
  • Gravity is no longer affected by the mass of the object.
  • The effect of the gravity on individual bodies can be regulated now with the body.gravityFactor property
  • You can add squares that act like a wall with the body.fixed property.
  • The bounciness of individual bodies can be regulated with the restitution property

Limitations:

  • Polygons/lines/triangles are not supported
  • Bodies won't rotate on collision

 

Share this post


Link to post
Share on other sites

I intend to leave it like this because it will probably be better to use a real physics engine if you want to do more realistic stuff. With rotation things get much more complicated). Having said so, I believe that this plugin provides enough options for about 90% of my current physics needs.

Share this post


Link to post
Share on other sites

Will you add support for collision between rotated Rectangles? It'll be very useful if a square body rotated and collide with others, but the collision don't affect their rotation as you said.

I know it sounds not REAL at all, but considering there's a large block falling down which is rotated randomly and hit the character to kill him, or bullets hit a rotated arm of boss...

Share this post


Link to post
Share on other sites

Perhaps I will adress this in the future but you must realize that it will complicate the plugin considerably. The current plugin is just 10 kb (compare this with the P2/Box2D-engine that both have a file size around 400kb). The small size is possible because of the limitation of not taking into account rotations.

 

For now you will have to pick Box2D/P2 for rotation.

Share this post


Link to post
Share on other sites

@Stephan

 

Looking at the code of this plugin, I am presented with the following error.

Uncaught TypeError: Cannot read property 'copy' of undefined

this error on the line, 249, of plugin.

 

The solution to this mistake was to remove that line of code.

 

If it's not the ultimate solution, but I worked on what I'm working.
 
It would be good that you check the code of this plugin it will work for the latest version of Panda engine
 
Thanks.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.