I'm using the code below in my Collisions.js file and my pickups work fine but there is about a half second pause in the characters forward movement. It's enough to be noticeable. What am I doing wrong? Thanks.
static var GEAR_COUNT = 0;
static var PLAYER_LIFE = 100;
function OnCollisionEnter (collision:Collision)
{
if(collision.gameObject.tag == "Gear")
{
// Add Gear To Inventory
GEAR_COUNT += 1;
print("You've Collected " + GEAR_COUNT + " Gears!");
// Destroy The Gear
Destroy(collision.gameObject);
}
else if(collision.gameObject.tag == "Battery")
{
// Add Battery Power To Player's Life
PLAYER_LIFE += 25;
print("You've Collected A Battery");
// Destroy The Battery
Destroy(collision.gameObject);
}
}
Perfect. Thanks so much.
– LaneFoxNo problem, glad I could help. :)
– e-bonneville