In this question I was given part of a script and told to attach it to my player. There are no errors, but the script doesn’t seem to do anything. Here it is:
var DeathSpeed : int;
function Update(){
}
function OnCollisionEnter(collision : Collision)
{
if(collider.relativeVelocity.magnitude > DeathSpeed)// where "someValue" is a variable of your choosing.
{
Debug.Log("DEAD");// You'll have to implement how the player will die, yourself, but just call the function(s) needed to kill them, here.
}
}
Can anyone help?
Print out the condition and see if it ever returns true. The logic may not be what you desire. To print out the "DEAD" your object will need to have a velocity greater than DeathSpeed and at the same time have a collision with this object.
– cdrandinI tried all of the suggestions so far, but to no avail. If anyone else wants to offer a suggestion that'd be great.
– OBrooksDev