Jump to content

[SOLVED] - Define Collision Box Or Capsule Size


MackeyK24
 Share

Recommended Posts

How do we define the size of our collision box (i goes would be the same for camera and physics)... Do we use mesh.ellipsoid and mesh.ellipsoidOffset to actual define our collision bound box ???  Don't seem to see a mesh.collisionRect or anything like that. I am trying to emulate the BOX and CAPSULE collider functionality in unity where you drag the "collider rect" to define size of collision box or capsule. I would then like to store those values on my node.metadata and use those to "DEFINE" the babylon.mesh collision rect :)

 

Link to comment
Share on other sites

mesh.ellipsoid is your friend :)

This is where you define the collision box, for example for the camera. Pay attention that camera collision inspection (for example) will ignore the mesh's ellipsoid definitions and will use the mesh's vertices instead to check Box-to-mesh collision. This is why you can walk on surfaces.

Link to comment
Share on other sites

FOr collisions (and not physics) we use an ellipsoid define on the camera (camera.ellipsoid). It is a "pure" collision meaning that the mesh data is used to determine collision.

If you want to emulate box or capsule collider, just emit an invisible box or capsule mesh (with parent set to original mesh and with setVisible(false)

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