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;
}
}