[SOLVED] Raycasting on a capsule collider

I have the issue where my raycast is going through the top and bottom of a capsule collider. The middle part works normal. To debug I set up a model with the same size. I have no problems with other colliders. Is this a bug or do I miss something?

Yes, that is a bug. :thinking:

https://playcanvas.com/editor/scene/971593

For whatever reason, the height is halved. Good catch.

Edit: Nope, I’m wrong. It’s an Editor rendering bug where the capsule is being rendered at double the height set.

GitHub issues: https://github.com/playcanvas/editor/issues/123

If it is a editor rendering bug, does that mean it’s working correct in launch mode?
That’s not the case in my situation…

It’s an Editor rendering bug from what I can tell. The default size of the capsule should be 2 units tall but is being rendered at 4 units.

If you can, can you create a small project to show the issue you are getting please?

If it is a editor rendering bug, does that mean it’s working correct in launch mode?
If so, I don’t think I would have noticed the problem…

Yes. The launch mode is at the correct height as set in the component from what I can see and what is seen in the example project I posted above.

No, that’s because you already have doublesized the collision height.

Not sure what you mean? The height set in the Editor is the correct height (2 units).

image

The height should be 1 unit, the same as the model. It’s not a half extend?

You are thinking about the scale of the Entity rather than the height of the model :slight_smile:

The property in the inspector is for the full height, not half extent.

The scale of the model (entity) must display the collider in launch mode. So the collider must have the same height as this model to show the problem.

The collider should be the same size as the model right? Don’t understand why you make the collider twice as height. That will prevent to see the problem.

I changed your project to show the issue.
You can see the capsule collider act like it is a cylinder or something.
https://playcanvas.com/editor/scene/971662

I had a look at the project you made, and the height is set at 1 which is incorrect. The model is 2 units high.

If we use the box as reference which is 1 unit in width height and depth, you can see that the model of the capsule is 2 boxes in height and therefore 2 units high. So the collider height also needs to be 2, not 1.

For me the capsule model is 1 unit high (not 2). So the capsule collider has to be also 1 unit high. Probably I don’t understand what is a unit?

The grid pattern that you see in the Editor? The size of each square represents one unit.

Moving an entity by one unit, (eg moving the position of an entity from 0,1,0 to 0,0,0 is the distance of one of those squares along one axis).

Aha oke. My bad. I was talking about the scale size. Sorry.

So if the scale on the y-axis of the capsule model is 1, then the height of the capsule collider has also to be 1. Otherwist the collider is higher then the model.

Sorry, don’t quite understand that?


This are the right settings for the model and collider for me.
With this setup the collision and raycast should be good, which it isn’t.