fixed bumper and boulder

fixed wallrun on regular player prefab
This commit is contained in:
Melbyj1125
2022-01-28 13:11:13 -06:00
parent 4042eb1c67
commit 6bab1292f6
6 changed files with 20 additions and 10 deletions

View File

@@ -13,14 +13,14 @@ public class Boulder : NetworkBehaviour
}
void OnTriggerEnter(Collider other) {
if (other.tag == "Player") {
if (other.transform.parent.gameObject.tag == "Player") {
GameObject player = other.gameObject;//Turns the collider into a game object
Vector3 Dir = boulder.velocity;//Finds the bolder's velocity
float Power = boulder.velocity.magnitude;// * 250;//Finds the power of the boulder by using it's velocity and a scaler
Dir = Vector3.Normalize(Dir);//Normalizes the vector to be used as a knockback direction
//Knock the player a little to the side
Dir.z += Random.Range(-0.25f, 0.25f);
player.GetComponent<dPlayerMovement>().GetHit(Dir, Power); //Ragdolls the player in the direction of the bolder depending on it's speed
player.GetComponent<PlayerMovement>().GetHit(Dir, Power); //Ragdolls the player in the direction of the bolder depending on it's speed
}
}

View File

@@ -8,7 +8,8 @@ public class Bumper : MonoBehaviour {
// Is called whenever something collides with the bumper
void OnTriggerEnter(Collider objectHit) {
if (objectHit.tag == "Player") {//Checks if the other object is the player
if (objectHit.transform.parent.gameObject.tag == "Player") {//Checks if the other object is the player
PlayerMovement playerMovement = objectHit.GetComponent<PlayerMovement>();
float DirBumpX = playerMovement.driftVel.x * -1;//Inverts the Player Velocity x