Jump to content

Racing game on uneven terrain


fdssdfsdgfdgs
 Share

Recommended Posts

I'm trying to create a racing game using BabylonJS (very similar to this: http://hexgl.bkcore.com/play/). The game track is an uneven mesh with walls. All the the physics collision examples I have seen use a plane for a ground surface, or a heightmap. I tried using Oimo.js, setting the track as a MeshImposter, and my racing vehicle as a BoxImposter. This isn't working at all... The BoxImposter collides with the MeshImposter way before they visually appear to touch. Is there a better way to do this?

Also, should I be using a physics engine for the vehicle movement itself? Or would it be better to handle its movement manually?

Link to comment
Share on other sites

Hi Port25, welcome to the forum.  No replies, yet, eh?  Sorry.

The MeshImpostor is a CannonJS-only thing, and it only interacts with spheres, at this time.  So, you're a bit limited, in that scneario.  With your track being a meshImpostor, your racing vehicle must use sphereImpostor(s).  With a one-sphereImpostor vehicle, the realism would likely be somewhat weak, and you would probably need to set that sphereImpostor to .fixedRotation = true.

Another way... is using multiple sphereImpostors on the vehicle, connected together with tightly-constrained physics joints/links (joints/links - same thing). 

One thing to think about:  SphereImpostors have very little surface contact with any other impostors, so they are essentially friction-less.  Not good for mass-active wheeled vehicles with sideways inertia (during cornering).  If the sphereImpostor(s) is/are rolling upon the meshImpostor, they CAN work pretty nice.  But if they start skidding/sliding, it would be like ice.

Also, physics engines can get a bit "heavy" on the CPU performance, so racing speeds could be limited.  A non-physics engine approach would probably keep the speeds substantially better.

I'm not sure what the best approach is, here.  I'll keep thinking.  Perhaps others will have ideas, so stay tuned.  :)

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