Jump to content

Gravity without fancy physics engine


joshcamas
 Share

Recommended Posts

The glitch is probably due to a wrong position setting.

Example : on collision, you may position the ball somewhere, but this location also triggers the collision call... so it's positioned again and again somewhere where the collision process is re-run. Just position it a bit farther, it should work.

 

[EDIT] facetData doc : http://doc.babylonjs.com/tutorials/how_to_use_facetdata

Link to comment
Share on other sites

12 hours ago, jerome said:

The glitch is probably due to a wrong position setting.

Example : on collision, you may position the ball somewhere, but this location also triggers the collision call... so it's positioned again and again somewhere where the collision process is re-run. Just position it a bit farther, it should work.

That's what I'm thinking! But it *shouldn't* do this, because it moves it by the distance... (delta). But I'll check it out, thanks!

Link to comment
Share on other sites

  • 3 months later...

Alright, we're getting there! Simple collision works!!

http://www.babylonjs-playground.com/#1BVXYE#25

How it works:

The collision system is currently static vs dynamic, aka a character vs a wall.
This is done by enabling static collision and dynamic collision by collision group. This allows different objects to collide to different objects.

    staticMesh.enableStaticCollision("world",scene);
    dynamicMesh.enableDynamicCollision("world",scene)

Adds both a static and dynamic mesh to the collision group "world".

And now to update the collision system, simply run:

scene.updateCollision()

In your update loop.

The next step is a dynamic+dynamic collision, although I'm not quite sure how I'll design that. Also, maybe different shapes, as well as custom bounding boxes. (instead of using the bounds built into the mesh. It'd also be interesting to implement bouncing and other simple physics stuff

I'm also considering adding a simple bounding box visual system, and *maybe* add higher end collision (rotation affects collision)

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