Quickly spinning player glitches through walls

Video of glitch

Hello! I am seeming to have this problem and I honestly don’t what’s causing it. It doesn’t do it when I walk normally into it. I’ve tried putting the rotation in FixedUpdate() and nothing changes. I’ve also tried setting all of the colliders to continuous dynamically.

Thanks!

EDIT: It has something to do with my weapons. When I disable them and I have no weapons, I can’t spin through.

I would suggest you use “Physics Movement”, rather than “Moving” the game object directly!! (Keep your weapon collisions on, when trying this, it should still work).

I only used Unity 2D so far, but this is relative in 3D too!

Here is how to set it up correctly, so that your “collisions” works.

  1. Make sure your “Player” has a Rigidbody and a Collider.
  2. Set up your Rigidbody, like mine in the image.

    NOTE: Ensure that “Interpolate” is on.

Next, use this code to move your playerObject:

    public float movementSpeed;
    private Rigidbody rb;

    void Start()
    {
        rb = gameObject.GetComponent<Rigidbody>();
    }

    private void FixedUpdate()
    {
        rb.velocity = new Vector3(Input.GetAxis("Horizontal")*movementSpeed ,0, Input.GetAxis("Vertical")*movementSpeed);
    }

`

  1. Also, if you find that you get “stuck on walls”, add a “Physics Material” with no “friction” to your “Box Collider” to do so:.
  2. Right click on the “Assets” folder in the inspector.
  3. Choose: Create → Physics Material.
  4. Name it “noFriction”. Then at the top right, make all the values “0”, and “minimum”.
  5. At your “Box Collider”, drag the new material into the “Material” section.
  6. You should have no more “friction on walls”.

Hope this helps!!

`

Like UnityM0nk3y said, change collision detection to continuous should fix the error