Search Unity

character looks like hes clipping

Discussion in 'Scripting' started by puddleglum, Nov 25, 2020.

  1. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    412
    my player looks like hes clipping when hes moving. this i sprobobly because of the camera because when i set the camera not to follow him he doesnt clip like that. im just using simple cinemachine and no fancy settings just out of the box settings why does it appear like hes clipping when hes not, hes not even coming into contact with any collider.


    he also only starts to clip when he gets into the hard follow sections of the camera.
    it rarely happens when im in editor mode and often happens when im in full screen mode.
    Heres my walk script even though its probobly not neccesary

    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. public class WalkScript : MonoBehaviour
    6. {
    7.     [SerializeField] private Animator Walk;
    8.     public float speed = 30;
    9.     Rigidbody2D RB;
    10.     private SpriteRenderer SpriteRen;
    11.     // Start is called before the first frame update
    12.     void Start()
    13.     {
    14.         RB = GetComponent<Rigidbody2D>();
    15.         SpriteRen = GetComponent<SpriteRenderer>();
    16.  
    17.     }
    18.  
    19.     // Update is called once per frame
    20.     void Update()
    21.     {
    22.         float xMove = Input.GetAxisRaw("Horizontal");
    23.         float yMove = Input.GetAxisRaw("Vertical");
    24.  
    25.  
    26.         RB.velocity = new Vector2(xMove, yMove) * speed;
    27.         if (Input.GetAxis("Horizontal") > 0)
    28.         {
    29.             SpriteRen.flipX = true;
    30.         }
    31.         if (Input.GetAxis("Horizontal") < 0)
    32.         {
    33.             SpriteRen.flipX = false;
    34.         }
    35.  
    36.     }
    37.  
    38.  
    39. }
    40.  
    41.  
     
    Last edited: Nov 25, 2020
  2. bobisgod234

    bobisgod234

    Joined:
    Nov 15, 2016
    Posts:
    1,042
    Really going to need a screenshot of what you mean by clipping. There is nothing obviously wrong with that code.
     
  3. puddleglum

    puddleglum

    Joined:
    May 11, 2020
    Posts:
    412
    ignore the watermark. bad quality and bad graphics... just focus on the character i guess lol