Untitled
unknown
plain_text
3 months ago
433 B
1
Indexable
using UnityEngine; public class BallKick : MonoBehaviour { public Rigidbody2D ball; public float kickPower = 10f; void Update() { if (Input.GetMouseButtonDown(0)) // کلک پر کک کریں { Vector2 direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; ball.AddForce(direction.normalized * kickPower, ForceMode2D.Impulse); } } }
Editor is loading...
Leave a Comment