mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-22 09:44:15 -05:00
-two scritpts that deal with kick logic -added ball and leg to player in Evan_Prototypes scene
26 lines
613 B
C#
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);
|
|
}
|
|
}
|
|
}
|