Jump to content

Heightmap with the physics engine


RaananW
 Share

Recommended Posts

Oimo cannot support heightmap, as it only has spheres and boxes impostors. The heightmap demo on oimo's website is actually a lot of spheres simulating a surface. this works only with specific surfaces.

I have to say that I am trying to work on a solution, but so far my tests were not very successful. I will keep everyone informed.

 

BTW - I find cannon.js better than Oimo in regards to physics calculations. Oimo runs smoother, but lacks a lot of features that cannon offers.

Link to comment
Share on other sites

  • 1 year later...
  • 2 weeks later...
  • 2 weeks later...
On 4.01.2017 at 8:53 PM, Deltakosh said:

Can you elaborate a bit more?

Sorry I didn't see your message, I'm new to this website and I followed this topic to get notifications. I think it's just because only spheres can collide with heightmap right? Then I have to do physics bodies on my own. Is there a way to plot any object (triangle in 3d space) and give it physics? I'm not talking about cloth physics, but I think I the best way to make physics body is to create many invisible boxes or spheres and joint them. I will try it anyway, if you have any other suggestions please let me know ;) BTW how I'm doing "rigid" joint? I use two hinge joints in 2 different axis. That's all.

Link to comment
Share on other sites

  • 3 months later...

I'm new!
I have a problem with my project, whenever I try to put the impostor at the heightmap it does not work. I used the callback for the impostor, then I assigned the impostor there and created the sphere. I already tried the old post about height and physics.
¿Could you help me plz?
 

Link to comment
Share on other sites

Hiya Cosmic, welcome to the forum.  We (I) am currently working an issue that might be related to your problem.

Here's the talkie thread:  http://www.html5gamedevs.com/topic/29881-heightmapimpostor-dont-work-correct/

Here's the playground demo that shows the heightmapImpostor ONLY working on its southWest 25% area.  The latest theory (mine only) is that the invisible heightmapImpostor needs to be re-position northEast a bit, and then... fixed. Still studying it.

There's some talk around the forum (including recently, in the Bugs sub-forum) about a recent change in some boundingBox measuring tools... that COULD be causing the problem.  I'm not really qualified to find the problem, but I AM a professional whiner... so I'll keep whining until someone can explain what is going-on.  So far, I've been kept in the dark... but I am still investigating.

Since pinging @RaananW seems to be 'en vogue', I'll do it yet again.  He's pretty sharp in the physics department, but he's darned busy in real life.  Stay tuned, and try to be patient.  Again, welcome.  Sorry to hear you are having troubles.  We're on it... I think.  :)

Link to comment
Share on other sites

Hi Cosmic and other forum folk.  Whelp, I've been grinding this issue for a week, now.  Needless to say, I'm failing miserably.  It is also related-to another issue.

http://www.babylonjs-playground.com/#1RKZXB#16

Changed camera to aiming +z.  All core physics classes have been inserted into this testing PG.

The only working physics quadrant is lower right [-z/+x quadrant].  Impostor extends beyond lower right corner of mesh, so I am assuming impostor needs re-positioning.

I think the problem is in lines 1023-1043 area... but I am having NO LUCK correcting it, or even working-around it.

Calling all forum helpers.  I/we need the impostor positioned 250 units northwest (-x+z) (or a fix for whatever is causing the issue).  Please help.  Thanks.

Link to comment
Share on other sites

I've been through this without any luck as well.

http://www.babylonjs-playground.com/#1PX171#23

In all those examples, I use the very first heightfield I got working using the function implemented in Babylon.js:

For some reason, I've had a really hard time switching this heightfield with just about any other heightfield/mesh, This leads me to believe that the issue is with the createHeightmap function. Somewhere. Maybe the extentsize handling. I'm not at all sure. Cannon.js is known to have issues with heightfields, but I believe this is an issue with that function. If memory serves me right, I got it working only after exporting my model to clara.io, and then using clara.io's .babylon blender-exporter. Using 3Ds max' own exporter didn't work for some reason. In my example, look how much the heightfield in 'off' based on its scale:

heightBody.position.y = -18;
heightBody.position.x = -120;
heightBody.position.z = 120;

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
28 minutes ago, Deltakosh said:

Can you repro on the PG?

I may have spoke to soon.. this is odd, I create objects then give them imposter and they are fine, but for some reason my actor model falls through the ground and it uses boxImposter so it's not complex, it only happens with certain imported meshes though.. is there anything known that could cause one imported mesh to behave like that but not another all using boxImposter?

Something is going on but not what I initially thought.

Link to comment
Share on other sites

Hi Nittrus.  Could you test one thing for me? 

Imagine your ground is divided into 4 equal "quadrants" or sub-areas.  Please test all 4 quadrants... for player fall-through.  In other words, drop your player towards back-left corner of ground, then back-right quadrant, then front-left, and front-right.  Any interesting things seen?  Perhaps player doesn't fall-thru in ONE quadrant, but DOES in other 3 quadrants?  Just curious.  We have seen something like that before.

In that issue, I believe the solve was related to the ORDER of ground.convertToFlatShadeMesh() and adding the physicsImposter.  If you ARE using flat shading on your ground, you might want to turn that off, and see if anything changes.  *shrug* 

Also, physics world.step and physics world scaling, have been mentioned around the forum.  If the player drops from the sky at a very fast velocity, there is a chance that the physics engine steps... are not happening fast enough to "catch" the collision.

You'll need to do some forum searches and playground searches... to get the details on those.  Most times, those things don't need adjustments.  And the inconsistency of your fall-thru... hmm... that seems to point to some other problem.  We'll all keep thinking, and you report discoveries, ok?  The Cannon HeightMap demo #75 has been seemingly working pretty well, last we knew.  (not seriously torture-tested, though)

Just some thoughts.

Link to comment
Share on other sites

4 hours ago, Wingnut said:

Hi Nittrus.  Could you test one thing for me? 

Imagine your ground is divided into 4 equal "quadrants" or sub-areas.  Please test all 4 quadrants... for player fall-through.  In other words, drop your player towards back-left corner of ground, then back-right quadrant, then front-left, and front-right.  Any interesting things seen?  Perhaps player doesn't fall-thru in ONE quadrant, but DOES in other 3 quadrants?  Just curious.  We have seen something like that before.

In that issue, I believe the solve was related to the ORDER of ground.convertToFlatShadeMesh() and adding the physicsImposter.  If you ARE using flat shading on your ground, you might want to turn that off, and see if anything changes.  *shrug* 

Also, physics world.step and physics world scaling, have been mentioned around the forum.  If the player drops from the sky at a very fast velocity, there is a chance that the physics engine steps... are not happening fast enough to "catch" the collision.

You'll need to do some forum searches and playground searches... to get the details on those.  Most times, those things don't need adjustments.  And the inconsistency of your fall-thru... hmm... that seems to point to some other problem.  We'll all keep thinking, and you report discoveries, ok?  The Cannon HeightMap demo #75 has been seemingly working pretty well, last we knew.  (not seriously torture-tested, though)

Just some thoughts.

Found the issue and I haven't a clue what the line of coding causing it was for but it had to do with clamping Z quaternion, I'm going based on memory now as I had to leave after I had fixed the issue and came back to see your reply. I still have no idea why that would have caused the issue but it seems it was something that got added for a reason that is no longer valid so yeah, all fixed, not a bug in Babylon after all just my code!

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