Multisphere getting sucked through ground

Post Reply
Aperico
Posts: 7
Joined: Mon Feb 03, 2014 2:15 pm

Multisphere getting sucked through ground

Post by Aperico »

Hello. I have made several attempts to fix this and read all I could find here/google. I used ccd treshold mush lower than my objects move speed and using a ccd radius much smaller than the objects half radius. The only thing this does is make the multisphere get stuck on seams. I also tried to set ERP/ERP2 to 0.9/1.0.
[EDIT] Ok, so after some more reading; CCD will not work if the sphere is already touching the ground and ERP only affeccts objectts with joints if I understand correctly.

The ground is a trimesh made in Blender and using the obtainStaticNodeShape to get the shape. I have tried to scale the mesh to get smaller polygons but even the smallest (for the game acceptable) size does not work, about 32k indices with 11k polys, 500x500 units, the multisphere has a radius of 0.45 units.
[EDIT] the multi-sphere is two spheres on top of each other and they are restricted to angular movement in Y-axis only, so no rolling.

The sphere gets "sucked" fast through the ground it does not sink slowly. I tried to make the fixedtimestep smaller 1/420 with 64 substeps did not give any better results. This happens most often while ascending or descending a slope. My ground is gently sloped but an incline of 20% seems to be enough for it to fall through but it can happen on level ground too, just not as often.

When I did my first test I used a big cube as ground it worked well.

So my problem now is I don't even know why this is happening so I have no idea what to try next? Can anyone please give me some pointers.

Is there any use in increasing the multisphere size (for the game I can not increase more than 25-30%) I have not explicitly set any collision margins but I think this would just make my sphere float over the ground? Is there any profit in changing the ground from a static object to a kinematic?

Would it work to use a raytest from the sphere straight down and push it up if it is lower than the ground? I think not, why would it fall through if it could detect the ground in the first place..?
Aperico
Posts: 7
Joined: Mon Feb 03, 2014 2:15 pm

Re: Multisphere getting sucked through ground

Post by Aperico »

I still can not get this to work. If anyone could please take a look and give me some pointers I would really appreciate it. I posted it on stack overflow if anyone want to get some points, thanks!

http://stackoverflow.com/questions/2570 ... ugh-ground
Aperico
Posts: 7
Joined: Mon Feb 03, 2014 2:15 pm

Re: Multisphere getting sucked through ground

Post by Aperico »

I continued to wrestle with this problem and has got a few more clues. I think my problem is related to at least 2 things:

1. the shape: sphere, multisphere and capsule all go through on certain spots all the time. Using a cylinder shape I can only get it to fall through if I increase it's linear velocity from 4 to 10 m/s

2. the ground mesh: I am pretty sure it is not anything wrong with the normals (looked in debug draw and printed all normals)
I read somewhere that to long and thin triangles don't work very well so it might be that, but I do not know how long and how thin.

Please take a look at the image I attached. It shows wireframes with normals and I have marked a seam where the sphere always falls through even if it is only sliding <1m/s. The cylinder will also go through there eventually with high enough speed and just the right angle. But with same speed as the sphere or capsule it will instead just get a little jerk/stop and then go over the seam.

I do not think that the triangles in the image are very thin or long but then again there is no information anywhere about what is too long/thin.
Attachments
bullet_issue_1.png
bullet_issue_1.png (63.14 KiB) Viewed 10578 times
marios
Posts: 52
Joined: Mon Jul 19, 2010 3:11 am
Contact:

Re: Multisphere getting sucked through ground

Post by marios »

Your triangles are too big in my opinion. I also had this problem and the main character almost randomly get sucked through the ground in some places. What I have done is to load the mesh into blender and then add subdivide modifier( with simple option if you want too keep geometry the same or catmull-clark if you want to add some smoothness) which divided every triangle into two or more triangles.
Aperico
Posts: 7
Joined: Mon Feb 03, 2014 2:15 pm

Re: Multisphere getting sucked through ground

Post by Aperico »

Thank you for the answer! This was pretty bad news, I can not really have any more polys for the ground (developing for mobile). I have now tried to smooth (smooth brush in sculpt mode blender) the ground and it seems to be a bit better, I have to do more testing though.

It can not only be the size of the triangles? I have 3-5 times larger triangle which I do not have any problem with. These bigger triangles are where there are flatter ground though so maybe it is a combination of triangle size and the angle between edges? (hoping smoothing the terrain will help)

Is there anything else I can do to get this to work better? Like setPlaneConvexMultipointIterations(3,3) or setConvexConvexMultipointIterations(3, 3); I guess these two will not make any difference in my case, right? Are there nothing like a setConvexConcaveMultipointIteration()?
marios
Posts: 52
Joined: Mon Jul 19, 2010 3:11 am
Contact:

Re: Multisphere getting sucked through ground

Post by marios »

I have never developed for mobile, but it is really too much to increase the number of triangles? Bullet itself is very fast(especially bvh mesh shape). I would try if doubling the triangle count helps - this is easy fix which helped me. I also remember that I also wanted to avoid increasing the triangle count, so I was changing the parameters of the ground and the player like crazy, hoping that something will help. The best results I got with increasing collision margin (of dynamic body, ground or both - I don't remember) - This helped with sucking dynamics objects through the ground, but the downside of that was that the objects were graphically floating above the ground. You can solve that floating by increasing graphical object scale by little bit. I didn't want to mess with the scaling so I just increased the triangle count by subsurf modifier in blender.
Post Reply