I know the title isnt very explanatory, but here's my problem:
I have a player (merely a cube with a rigidbody, a collider and a movement script), and I have a floor made of small 1 by 1 by 1 cubes (cubes with box colliders).
For some reason unknown to me, when my player cube falls and tries to collide horizontally with the floor, he just phases through... But want him to get blocked by the cubes just like it does vertically. Any help would be greatly appreciated ;)
heres how the scene looks like
heres a cube object
heres the player object
Here's a gif of the player going through the floor
Here's my c# player movement script (I know its very bad, but I prefer to put this here just in case its linked to my problem) :
void ApplyMovement()
{
transform.position += new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
}
If you need any more info to help me just tell me, I'll provide it as fast as I can.
PlayerMovement
script. Directly manipulatingtransform.position
leads to issues like this (you should instead be either applying forces or manipulating the velocity of theRigidbody
so the physics engine can do its thing). And FWIW, you wont needRigidbody
components on the floor. That's for allowing the physics engine to manipulate anGameObject
's movement and theBoxColllider
they already have is sufficient for them to act as a static "floor." – Foggzie