- Home /
This question was
closed Dec 07, 2015 at 09:48 PM by
yvyv1000 for the following reason:
Fixed
Player colliding with pickable object
so I have a script
var Target : GameObject;
function OnCollisionEnter (collision : Collision){
if(collision == Target)
{
StoneFire.maxShots += 1;
Destroy(gameObject);
}
}
target is the Player and when the game object (ammostack) collides with Player it will had some maxShots to players maxshots var and will destroy itself but the player just goes through the ammostack the player has a rigidbody with is kinematic on. the ammostack has a rigidbody and gravity off because of is trigger. it should destroy the ammostack when it collides with the player but instead it does nothing. it won't add maxShots neither will it destroy the ammostack whats wrong?
Comment
fixed it already
var ShootObject : GameObject;
function Start (){
ShootObject = GameObject.FindWithTag("Spawn");
}
function OnTriggerEnter (collision : Collider){
if(collision.tag == "Ammo")
{
ShootObject.GetComponent(StoneFire).maxShots += 1;
//Destroy(collision);
}
}