You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
614 B

4 years ago
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ExplosionTest : MonoBehaviour
  5. {
  6. [SerializeField]
  7. private float Force = 1;
  8. private void OnTriggerEnter(Collider other)
  9. {
  10. var horse = other.GetComponent<PlayerController>();
  11. if (horse != null)
  12. {
  13. Vector3 force = Vector3.up * 2 + Vector3.ProjectOnPlane(Random.insideUnitSphere, Vector3.up) * Force;
  14. horse.AddForce(force);
  15. Debug.DrawRay(horse.transform.position, force, Color.red, 1f);
  16. Debug.Log("Throwing horse");
  17. }
  18. }
  19. }