#Keep falling through floor

1 messages · Page 1 of 1 (latest)

hot magnet
#

I procedurally generate a map, this map then gets the correct mesh added at the end doing the following:

mesh.Clear();
        mesh.vertices = vertices;
        mesh.triangles = triangles;
        mesh.colors = colors;

Where the vertices, triangles, and colors are assigned during generation

The mesh looks as follows in the finished map.

Now whenever I walk I keep falling through the floor, this happens both when walking, but also after not holding any input and just falling. My walking code is this:

private void FixedUpdate()
    {
        // Calculate the movement direction based on the camera's orientation
        Vector3 forward = cameraTransform.forward;
        Vector3 right = cameraTransform.right;
        forward.y = 0f;
        right.y = 0f;
        forward.Normalize();
        right.Normalize();

        // Calculate the new position using the movement direction
        Vector3 newPosition = transform.position + (forward * moveDelta.y) + (right * moveDelta.x);
        rb.MovePosition(newPosition);
    }

    public void OnMove(InputAction.CallbackContext context)
    {
        moveDelta = context.ReadValue<Vector2>();
    }```
The ground generator has a mesh collider, and I tried it with, and without rigidbody:


The player is a simple capsule collider with a Rigidbody attached:


Collision detection is set to continuous.
https://gyazo.com/70b3ecbd719490c20c068d473b8bee1e
native turret
#

It looks like there's no collision

hot magnet
#

Yes indeed, so how do I get a collision?

#

From my knowledge Ive set everything up there is to set up :(

native turret
#

Try your movement with a plane

#

See if you fall through the plane

#

Also check the collision matrix

hot magnet
#

It appears I do not fall through this mesh

#

which would be the plane you wanted me to try

hot magnet
native turret
#

Google and google

hot magnet
#

"Hey google why do I fall through one mesh but not the other"

#

So if the collision matrix only looks for layer that shouldnt have anything to do with this since everything is on the default layer currently anyways

#

yeah everything with everything by default, never changed it

native turret
#

What about the physics collision matrix

hot magnet
#

that is this one?

#

Now youre just playing with me

#

Thats all there is as collision matrix unless google is hiding something from me

#

Wether its this or not, its on default settings because I never thouched it

long girder
hot magnet
#

4000 is already considered far? Thats just the size of the map currently, if you mean the y value, thats just because Ive been falling for a hot minute on the screenshot

hot magnet
#

It also happens when near the world origin tho, just tried it. ESPECIALLY when I move, but since I use physics based movement and continuous collision detection that shouldnt be too much of a difference

hot magnet
#

<@&823670121133768714> I still wasnt able to solve this :(

#

It improved when I used rb.AddForce() instead of rb.MovePosition, but it still happens that I fall through the floor occasionally, even with no inputs just from falling down somewhere

candid berry
#

Check if you haven't accidentally set your player on the plane on OnTrigger

#

I do this shit multiple times accidentally myself

hot magnet
#

You can see my exact settings in my screenshots above, he is not set to "IsTrigger", also, he doesnt fall thorugh the floor 100% of times, what he would if he was :(

rustic current
#

Depending on how big your collider is there could be a chance you are teleporting through at high enough speeds/distance

#

Not sure though can you show your capsule collider as scale

#

Definitely possible for moveposition idk why it would happen for addforce though unless you go too fast

hot magnet
hot magnet
hot magnet
rustic current
heady lance
#

have you tried just not falling through the floor