Hi guys, we’re coding a falling game in the style of MDK cut scene levels, effectively we are trying to pick things up when we float down. We’ve got this script -
function Update(){
// basic falling script, downwards
transform.position.y-=0.5;
// axis controls
transform.Translate(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
}
function OnCollisionEnter (collision : Collision) {
if (collision.collider.gameObject.tag == "collectZ"){
//add 1 point to your score
scoreScript1.score += 1;
//destroy Z collectables
Destroy (collision.collider.gameObject);
}
}
So we’re not sure whether to use OnControllerColliderHit - given that we dont have a controller collider, we switched to using OnCollisionEnter. So we have a capsule collider on our falling character, and several tagged objects called collectZ that are collectable in other levels using OnControllerColliderHit and the 3rd person controller, but dont work in this adapted context.
Any help much appreciated!
Cheers,
Will