TheKingsRace/Assets/Scripts/Kick.cs
Evan Nydahl 981b42dc51 Added a rough kicking prototype
-two scritpts that deal with kick logic
-added ball and leg to player in Evan_Prototypes scene
2021-10-08 13:52:36 -05:00

26 lines
613 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Kick : MonoBehaviour
{
private float kickForce = 10f;
// Start is called before the first frame update
void Start(){
}
// Update is called once per frame
void Update(){
}
private void OnCollisionEnter(Collision collision)
{
if (collision.transform.CompareTag("kickable")){
Vector3 direction = this.transform.forward;
Debug.Log(direction);
collision.rigidbody.AddForce(direction * kickForce, ForceMode.Impulse);
}
}
}