Problems with Raycasting and Sphere overlap

Yes the colliders have it. You can add it on the stair colliders too maybe (or the capsule should work), i think you can configure to physics material to use the max value always

I will do some testing and get back, I did try adding that capsule collider with a 100 friction material but the character is unafected. Will try adding it on the stairs instead.

by user 326444095130042368

hello there, I am yet to try adding that physics material but in the meantime I have encounter another issue (I think)

So I am creating some raycastOptions to use the layer #3 and despite this it will still collide and detect only against layer 0 (the default one on Unity)

by user 326444095130042368

should the layer options be setup on a different manner?

by user 326444095130042368

Hi @Orlando Almario I will check it, it should work similarly.

Ok the layerMaskoption is a bit raw. It is expecting the value of the layermask OR a full threejs Layers

Here is one way you can do it:

export class RaycastTest extends Behaviour {

    private _layers: Layers = new Layers();

    update(): void {
        if (this.context.input.getPointerDown(0)) {
            const rc = new RaycastOptions();
            rc.layerMask = this._layers;
            rc.layerMask.set(4);
            const hits = this.context.physics.raycast(rc);
            if (hits.length) {
                console.log(hits[0].object.name)
            }
            else console.log("no hits")
        }
    }

}

ohh that is interesting, yeah I will try to do it this way. Maybe this could be a documentation update I could make a PR for that if possible

by user 326444095130042368

Iā€™ve updated a simplified api for that for the next version :slightly_smiling_face:

rc.setLayer(4)

to use it like you wanted to with the layer index