Ball flickering when move him

Hi, I have trouble with flickering ball. I recognize when I try to shoot it flicking little but when I launch firstime and try to move him again - it start rotate in Z axis and flicking more.

This is video of it: https://youtu.be/THi0Ob6oRzk

And this is code of BallHandler:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class BallHandl : MonoBehaviour
{
    private Camera mainCamera;
    [SerializeField] private Rigidbody2D currentBallRigidBody;

    // Start is called before the first frame update
    void Start()
    {
        mainCamera = Camera.main;
    }

    // Update is called once per frame
    void Update()
    {
        if(!Touchscreen.current.primaryTouch.press.isPressed){
            currentBallRigidBody.isKinematic = false;
            return;
        }
        currentBallRigidBody.isKinematic = true;

        Vector2 touchPosition = Touchscreen.current.primaryTouch.position.ReadValue();
        Vector3 worldPosition = mainCamera.ScreenToWorldPoint(touchPosition);            
        currentBallRigidBody.position = worldPosition;
    }
}

This almost looks like it’s fighting multiple spring joints, but I can’t be sure.

I would suggest moving to the next lesson and make the changes there, to see how things look.

After restart of computer it works fine (don’t know what was issue :confused: )

But I recognize also, I forgot to remove collider from Pivot, so in next lecture I fix it and the second lecture is better with it :smiley:
Funny thing: When you did not remove collider and remove SpingJoint it will hit pivot and bounce from them :smiley:

Privacy & Terms