# Are there any chances to show collider of a capsule mesh or change its size?

``````// My mesh:
playerCapsule = BABYLON.MeshBuilder.CreateCapsule( "capsule", {}, scene );
// My moving method. I don't use physics engine:
playerCapsule.moveWithCollisions( ... );
``````
1. Can’t find information about showing a collider of a mesh for debug purposes. Is there any properties to turn it on?
2. Is that possible to change a size of a capsule’s collider?
1 Like

I assume you talk about collision “ellipsoid” (collider is an extra bounding box if I remember correct and less performant).

About #2: How to change size of ellipsoid that works with moveWithCollisions() you can find in docs
(4. Object vs. object collision):

About #1: How to show the ellipsoid is represented in this PG example:

Thanks, that’s what I’m looking for. I didn’t know that it’s called ellipsoid, I thought it should called “collider”

I have one more question on that subject. Let’s say we have a simple box mesh ( CreateBox() ). How can we extend the size of its collision area bigger than the mesh’s size?
I guess it’s not changing its ellipsoid in this case

You want collision area to be bigger than mesh?

``````const meshSize = 10
const mesh = BABYLON.MeshBuilder.CreatBox('mesh', {size: meshSize}, scene)
mesh.checkCollisions = true
``````

This could also be done with length, width and height.

1 Like

Wow, but how is it works? Ellipsoid collider for a box mesh, wow, how is it possible?
My ground’s collider (just a plane mesh, checkcollisions=true) is also an ellipsoid? But how then it can be possible to walk by my box mesh (for i.e., which is also ellipsoid, I guess) on the ellipsoid’s ground?
BJS (w/o any physics enabled) interprets those ellipsoids and meshes with checkedCollisions enabled only by its bounding boxes?

You only need to set ellipsoid on meshes you use moveWithCollisions on. So on your ground you only need checkCollisions = true, check out the playground above. You can use it to test further like ground collision and move. Another helpful feature is mesh.showBoundingBox = true. If you get deeper and encounter different collision cases you can also use Collision Triggers: Collisions & Triggers | Babylon.js Documentation

1 Like

Hm, looks it’s not what I’m looking for as for making bigger collider size for a box. I meant I wanna extend the size of a collider for my box platforms in platformer to make the size of its collider bigger. To make the game easier. But I can’t just make platforms bigger because it will look too ugly. Platforms are static they don’t move.

To make bigger collision area in box shape you can set boundingInfo with your custom boundingBox manually:

1 Like

Could you please look at this? https://playground.babylonjs.com/#6EU8HW#6
I tried to extend a size of a box collider but looks moveWithCollisions() doesn’t see my new size. What do I do wrong here?

The same issue as mine: moveWithCollisions not working with setBoundingInfo - #4 by Rata_Blanca
Seems it really can’t be done, unfortunately

As a workaround I think I can make one more outer box, hide it and use it as my bigger collision area for a smaller box.
I’ve checked if you set: `mesh.isVisible = false` then mesh is not visible but the collision area still stays. So you can’t go through the absent obstacle There’s no any obstacle but you can’t go through.
Aslo I’ve noticed that we can use `setEnabled( false )` to hide the object completely with its collision area.

Anyway, it works when you call intersectsMesh() but it does not take into accont by moveWithCollisions(), it just ignores new bounding box info.

Is that a bug or is it by design?

You need to combine it, like this:

What I don’t like here is that there is no more bouncing. You would need something like raycast to reapply bouncing/drifting on wall or physicsengine.

Imo a bigger invisible mesh is also an option if your number of walls are limited.

1 Like