- Home /
How to make helicopter fall and explosion
How am i going to make my helicopter fall as my helicopter is now depending on Rigidbody to fly. my helicopter contains many smaller parts like mainbody, roter, camera so on. and some parts is attached with OnTriggerEnter explosion script. The helicopter is attached with OnCollisonEnter explosion script. So now i have to make it fall and Collision on the terrain to explode. So any1 knows how to make my helicopter fall please help me thx. as i am using another HUB script to tell my helicopter to fall in if(helicoper no fuel) fall.
My Rigidbody
Mass : 1276
Drag : 0.1
Angular Drag : 1.5
Use Gravity : Check
Is Kinematic : Uncheck
Some how i find a way to make it fall. is that when no fuel > make rotor and other speed = 0 or false. so it will fall.
So How am i going to make it explode, for now i got a way but not stable as i write if(helicopter.transform.position.y < 10) it explode. its not stable as only explode when hit on terrain which is height less than 10, what if it hit on height greater than 10 or onto mountain, it will not explode,i was think to use raycast if hit on anythings it will explode. But i doesnt know how to write it anyone help me pls .
if(helicopter.transform.position.y < 38){
audio.PlayOneShot(explodesound);
var explosion1 : Transform;
explosion1 = Instantiate(explosion,transform.position,transform.rotation);
}
I was given to believe that rigidbodies would fall under normal circumstances. What's stopping it from falling? Why not just use normal collision detection?
Come on, you can't just lean on people for this stuff! Use the search engine, better still look at the script reference. It's full of tutorials!
A simple way you could go about getting around your deal exploding at start impact would be caching your chopper's starting position.y , have a boolean set to false that you will set to true after you've taken off, compare your current position.y to your starting position.y + some float for height ; if it becomes greater-than, set your bool to true.
Then in oncollisionenter have it check that boolean. if its false, do nothing ; if it's true, blow sh*t up.
Answer by Pilot · Jan 19, 2012 at 02:57 AM
This should give you a good idea. It is one of the few unity Helicopter tutorials. If the rotors hit any collider they will explode and send the helicopter crashing to the ground. Good luck :)
this tutorial doesnt $$anonymous$$ch to to make it fall, anybody knows how to do it??
yea i already found a way on top, So do you know how to make it to call on collision and explode as if(helicopter.transform.position.y < 38){ then explode is not stable, i need to change it on collision then explode