elessar.perm

Advanced physics with Babylon.js

Recommended Posts

Hey guys!

 

I'm trying to make some advanced physics in my babylon project. To be more concrete:

 

There is a brick wall and a cannon in front of it.

Cannon makes a shot and when the shell collides with wall I want to shatter them.

So, for the wall I have two options:

  • Voronoi Fracture
  • Break the wall into bricks

Assume I will use second one.

According to forums I should break wall mesh into group of bricks with joints and remove some of them if the force is too strong.

 

And this is where the question appears: what is the best option to deal with it?

Should I expand oimo/cannon plugin to have more control over joints and ability to add native event listeners for collisions or just use Actions with intersection trigger? For now both plugins hide their world property and just implement plugin interface.

 

Thanks.

 

p.s. I'm new for babylon so it will be great if you could answer more detailed!

Share this post


Link to post
Share on other sites

It sounds like expanding would be a better option, because you cannot attach a intersection trigger between one object and "every other object in the game".

 

In other words, you have to specify two specific objects for intersection trigger. If your wanting this, do this. if you want a function to be called when anything intersects, I'm guessing OIMO or Cannon would be your best bet.

 

Anyone else smarter have any better input? :)

 

P.S: Nice avatar

Share this post


Link to post
Share on other sites
Thanks for your reply! This is something I wanted to know ;) .

 

And a little one question by the way:

 

How do I avoid situation when small and very fast shell (sphere) just flies through wall and doesn't collide it? 

I think I should increase physics precision in some way, but I don't understand how to achieve it without big impact on performance?

Share this post


Link to post
Share on other sites

Well having such a fast object would be very hard to fix- from my limited knowledge of the physics engine Im pretty sure if at one frame the object is on one side of the wall and the next frame on the other, it wouldn't detect collision.

However this is just a guess

Share this post


Link to post
Share on other sites
Thank you! This is great example!

I like Oimo for its speed. Shortcomings like limited body impostors are not very serious.

One last problem I have is physics precision as I told before. :)

 

I'm afraid that I need to implement sort of continuous collision detection by myself.

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.