- Home /
Player falling through the floor on running?
Hello everyone. Have anyone experienced a bug of player falling or sinking through the platform like in the video? I have added a plane with box collider. And box colliders on players feet. So, how to solve this bug?
Colliders are:
Protoype video:Video Url
Moreover sometimes the player falls down completely through the ground :/ .
Code to move player:
private void FixedUpdate()
{
float sideMotion = Input.GetAxisRaw("Horizontal");
float straightMotion = Input.GetAxisRaw("Vertical") ;
transform.Translate(Vector3.right * sideMotion * strafespeed * Time.deltaTime);
transform.Translate(Vector3.forward * straightMotion * movementSpeed * Time.deltaTime);
}
I think when you animate characters foots, your box colliders move up. So, you should create a different gameobject that independent of foots and includes box colliders.
that is an independent collider gameobject. Just parented to foot :/
I think issue is with animation, Does issue occurs without animation playing ?
I somewhat fixed the issue. On running, but now I everytime jump, my player sinks on ground. And I have not done any jump animation though.
Answer by hexagonius · Mar 22, 2017 at 07:38 PM
your animator needs to be configured to animate physics. other than that, do not translate the guy. either use AddForce, set velocity, or mark the rigidbody kinematic and use MovePosition.