Problems with Raycasting and Sphere overlap

image.png

by user 326444095130042368

Next update will have a better spherecasting :slightly_smiling_face:

see

our base problem really is we want an FPS character controller that can go up slopes, as the current characterController based implementation is unable to.

by user 326444095130042368

the right wall has layer set to IgnoreRaycast thats why it walks through

have you tried this sample? Needle Engine Samples

yep, if you try to make that character go up a slope

by user 326444095130042368

that does exactly that without any custom raycasting etc

after a certain amount of degrees

by user 326444095130042368

the character will fall down

by user 326444095130042368

Fall down?

in that inclination

by user 326444095130042368

gravity gets applied and it is unable to keep goin up the slope

by user 326444095130042368

You might just need to up the friction value (by adding a PhysicsMaterial)

and then the maxSlope parameter from unity is not really doing anything

by user 326444095130042368

ohhh, I did not try with friction

by user 326444095130042368

will check

by user 326444095130042368

Hi Orlando, if you want you can also try the latest release with physics.sphereOverlapPhysics

Here’s the code i used for testing in your scene

 CheckWithSphere() {
        const spherePos = new Vector3().copy(this.worldPosition).add(this.speed)
        const size = .3;
        const hits = this.context.physics.sphereOverlapPhysics(spherePos, size);
        Gizmos.DrawWireSphere(spherePos, size, hits?.length > 0 ? 0x444444 : green);
        if (hits.length > 0) {
            console.log("hit", hits)
            this.speed.set(0, 0, 0);
        }
    }

thank you, will try it out!

by user 326444095130042368

Hellow! @marcel :cactus: I am coming back to Improving our controller and wanted to give your PhysicsMaterial Idea a try.

But the CharacterController does not have a PhysicsMaterial value, only regular colliders seem to do so.

was that your recomendation or am I missing something?

by user 326444095130042368