Hello everyone, I’m new to unity, I’m running to create a game, everything goes well but I do not know how to remove a wheelcollider.
Let me explain: In my game there is a bug, when I turn over my car, the wheel collider are multiplying like:
//LeftFront_WheelCollider
LF_WheelCollider(clone)
LF_WheelCollider(clone)(clone)
LF_WheelCollider(clone)(clone)(clone)
LF_WheelCollider(clone)(clone)(clone)(clone)
...
And that the execution of the game slowed considerably so my question is:
How, through a script I could remove a WheeCollider?
My condition would be:
wheelCollider if (clone) = true then destroy wheelCollider (clone)
But I do not know how to transcribe into his script and if it’s the solution for my problem.
I’ve never coded in Java or C # or but I know lua coding.
I tried to write a script but it nothing happens.
#pragma strict
var LF_WheelColliders : WheelCollider;
function Start(){
}
function Update () {
}
function destroy(other:Collider){
if (LF_WheelColliders == true) {
Destroy(LF_WheelColliders);
}
}
Thanks everyone
Sorry: Translation by Google