- Home /
Collider Don't work
I making a game. You need bomb car and heal with water...
var Gyfka : int;
var GoodTag : String[];
var BadTag : String[];
var Ugnis : Transform[];
var Dumai : Transform;
var Groteles : Transform;
var Ratai : Transform[];
var Sprogimas : GameObject;
function OnCollisionEnter(other : Collision){
Debug.Log("Test");
if (other.collider.gameObject.tag == GoodTag)
{
Gyfka += 6;
}
if (other.collider.gameObject.tag == BadTag)
{
Gyfka -= 37;
}
}
function Update(){
if(Gyfka >=25){
Dumai.particleEmitter.emit = true;
}
if(Gyfka >=10){
Ugnis.particleEmitter.emit = true;
}
if(Gyfka >=1){
Instantiate(Sprogimas, Groteles.transform.posion, Quaternion.identity);
Ratai.GetComponent(HingeJoint).enabled = false;
}
}
function OnGUI(){
GUI.Box(new Rect (10,Screen.height - 200,200,20), "Riebulkos Mašinos Sveikata:" + Gyfka);
}
I working with this script for 3 days. It starts me angry WHAT I DID WRoNG I put this on car's collider
You posted 16 $$anonymous$$utes ago, so first : be more patient ... Second : there is no question !
What is the problem ? What is happening ? Or what is not happening and should ?
This might help you understand things better: Unity Tips and Tricks
You are comparing a tag with a list of string, does this even compile ?
Post a question that explains in more depth the problem you have. Being angry, and working on it for 3 days isn't enough information for anyone to help you. It might take the community a day or more to help you. The more detail you can add about the problem, the better your chances of getting help.
Answer by Graham-Dunnett · Apr 23, 2013 at 09:43 PM
So, I copied your code into a project I have open. I got the following errors:
Assets/blah.js(27,15): BCE0019: 'particleEmitter' is not a member of 'UnityEngine.Transform[]'.
(Filename: Assets/blah.js Line: 27)
Assets/blah.js(30,51): BCE0019: 'posion' is not a member of 'UnityEngine.Transform'.
(Filename: Assets/blah.js Line: 30)
Assets/blah.js(31,15): BCE0019: 'GetComponent' is not a member of 'UnityEngine.Transform[]'.
(Filename: Assets/blah.js Line: 31)
So you have at least 3 problems. I don't understand why you have arrays of Strings and Transforms. Those look wrong to me. Usually what you have defined as Transform
s would be GameObject
s. You use posion
where you mean position
.
Thanks Graham Dunnett ♦♦ You saved my day there was error on array and poison :D THAN$$anonymous$$S
Your answer
Follow this Question
Related Questions
Car dynamics? 0 Answers
Help with car collision in arcade racing game 2 Answers
Getting contact force between two rigidbodies 1 Answer
Make the player not able to walk in/on water 3 Answers
2d car end line error help 1 Answer