private void ShootBall(Collision collision) { Vector3 launchDirection = (baseLaunchDirection.normalized + (collision.collider.transform.position - transform.position).normalized * relativeDirectionFactor).normalized; Vector3 launchVelocity = launchDirection * power; scoreObstacle.Hit(); collision.collider.attachedRigidbody.velocity = launchVelocity; }
private void OnTriggerEnter(Collider other) { if (other.gameObject.layer == LayerMask.NameToLayer("Ball")) { Vector3 launchDirection = (other.transform.position - transform.position).normalized; Vector3 launchVelocity = launchDirection * power; scoreObstacle.Hit(); other.attachedRigidbody.velocity = launchVelocity; } }
public void OnTriggerEnter(Collider other) { var ball = other.GetComponent <Ball>(); if (ball != null) { scoreObstacle.Hit(); vacumedBall = other.gameObject; StartCoroutine(KeepBal()); } }
public void OnTriggerEnter(Collider other) { var ball = other.GetComponent <Ball>(); if (ball != null) { scoreObstacle.Hit(); teleportingBall = other.gameObject; velocity = other.gameObject.GetComponent <Collider>().attachedRigidbody.velocity; teleportingBall.GetComponent <Collider>().attachedRigidbody.velocity = new Vector3(); teleportingBall.SetActive(false); audioController.Teleport(); StartCoroutine(StartTeleport()); } }