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

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ExplosionTest : MonoBehaviour
{
[SerializeField]
private float Force = 1;
private void OnTriggerEnter(Collider other)
{
var horse = other.GetComponent<PlayerController>();
if (horse != null)
{
Vector3 force = Vector3.up * 2 + Vector3.ProjectOnPlane(Random.insideUnitSphere, Vector3.up) * Force;
horse.AddForce(force);
Debug.DrawRay(horse.transform.position, force, Color.red, 1f);
Debug.Log("Throwing horse");
}
}
}