Hi there I running into a problem with my script. So I’m having it where these objects I have with the name alien have it when they run into this wall they will destroy but for some reason they go to it but do not destroy. I have the right tags up. Here is the code for the wall I have
function Update(){
}
function OnCollision(collider: Collision){
if (collider.gameObject.tag == “alien”){
Destroy(gameObject);
}
}
and here is the code for the objects as alien that go to the wall
var target : Transform;
var moveSpeed = 3;
var rotationSpeed = 3;
var myTransform : Transform;
function Awake()
{
myTransform = transform;
}
function Start () {
target = GameObject.FindWithTag(“robot”).transform;
}
function Update () {
transform.LookAt(Vector3(target.position.x, transform.position.y, target.position.z));
now I have it where the wall has robot and the alien have the tag alien on it. I will also say I tried using a ontrigger as well and trying a code on the aliens if they hit it they destroy. Anyone have any suggestions. I make it where its real simple just a square going to another cube.
If you want something to occur on collision, you should use OnCollisionEnter(), there is no OnCollision().
Edit: If you want others to look through your code, you should use the code tags as a common courtesy, no one wants to try understanding unformatted code.
you know what, I just see I didn’t have the rigid body on with the kinematic on so let me see if that why it wasn’t working. I really appreciate all this help.
also sorry about that, I never posted in the forums before so my mistake. terrible sorry about that.
Going to lecture about common courtesy, then when giving a correction, don’t assume anyone else knows it or knows how. Thats an awesome idea, having seen others use that, would like to, but I have no idea how, and I guess I could start searching, but the problem is I"m ALREADY searching for an answer for other things, and thats not working out so well.
Wow, came off way angrier then I meant it. >_<
But the concept remains, if your going to be condescending about it, at least have the good grace to tell how to do whatever it is you so feel is required.
One sentence is a lecture? I was just reinforcing what @ung was saying, since wolfer seemed to be coming up with reasons to not use code tags at the time of my post.
Also look at post #2 and #4, I thought wolfer read those so why would I bother explaining it myself?
No, not really, like I suspected then, I had no business posting a hello at that moment, let alone anything else. Everything I was typing was coming off angry.