- Home /
Question by
el-mas-pro-470 · Aug 11, 2018 at 02:11 PM ·
carcar gamecar physicscar race
Destroyed car styled need for speed?
Hello! I tell them that I continue with my car project and I need to make the car when it hits a lot of speed fly out and that a sign appears that says "destroyed" with a camera that follows the car already "destroyed" (style need for speed). if someone has a comment ides! thank you very much to all!
Comment
ready! i modifiqued a script an this is the results!
var damageConstant : float; var carHealth : float; var carTotaled : Transform; var clone : Transform; function OnCollisionEnter( col : Collision ){
if(col.relativeVelocity.magnitude > 10){ //remove this
carHealth -= damageConstant * col.relativeVelocity.magnitude ; //line 1
} //remove this
if ( carHealth < 0 ){
destroyCar();
}
}
function destroyCar(){
//instantiate some fancy particle system for special effects
//and maybe instantiate a heavily damaged car on its place
clone = Instantiate(carTotaled, transform.position, transform.rotation);
Destroy(gameObject);
}
Your answer
Follow this Question
Related Questions
drift car using rigidbody 1 Answer
how to rotate car to camera direction using wheel colliders. 1 Answer
Better RPM?? 0 Answers
transmission clutch help! 1 Answer
Car Gearbox script 1 Answer