Jump to content

Problem rendering thin boxes


jsgirald
 Share

Recommended Posts

Hi, I've been doing a little experimenting, and lurking around this forum for a while.  

Now I'm tryng to understand what's wrong with my latest test (see this playground). 

It's just a deck of cards randomly spread on a table, using cannon.js and a few thin boxes to represent cards.

First I had to replace my original ground plane with a somewhat thicker box, apparently the physics engine lacks precission and the falling cards were just going through it.

Then, once this was sorted out, I see the same effect happening to the cards themselves, but I don't know what could be done, so any advice would be appreciated. :)

There's also some annoying flicker sometimes when the cards are on the table. 

Another question is the way to set up the physic state of objects, when I change fromv2.5 to v3 it complains that 'setPhysicsState is not a function'. Is this going to be deprecated? What is the best practice in this case?

I have to say that Babylon has been quite a discovery, easy to use and very well documented, and support is excellent, most of my previous questions were resolved just searching this forum!

Thanks to the team for such an outstanding job!

Link to comment
Share on other sites

Hey and welcome ;)

Regarding the flickering it could be cause by z-fighting, you can use material.zOffset to offset your cards a bit

Regarding the deprecated function, you can check our breaking changes list here: https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview release/what's new.md#breaking-changes. I also suggest reading the documentation page for the new physics engine: http://doc.babylonjs.com/overviews/using_the_physics_engine

Regarding the thin boxes, this is perhaps a limitation of cannon.js. Let me try to add @schteppe to this thread ;)

 

Link to comment
Share on other sites

Thanks for your prompt reply,

zOffset helps with that flicker, but I have yet to tweak it properly (BTW a negative number does the trick?)

Somehow I had read the basic overview on physics but I managed to miss the breaking changes doc :rolleyes:. Hate to bother but, any advanced tuto on this?

I went to cannon.js directly and yes, apparently it does not implement CCD and that is why tunneling happens. Changing the step helps, but I think is not an ideal solution in most cases.

Also I had the idea of using Sprites (one per side), but they're not "IPhysicsEnabledObject" and cannot use physics, right?

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...