#ill try
1 messages · Page 1 of 1 (latest)
i thought you wanted to see if it prints on finish line
I do. I want to see what tag it prints when you touch the finish line
So print the tag no matter what you hit, and see what it says when you're supposed to be touching the finish line
The first line of OnCollision
No, just log the tag of the other object as the first line of your function
other object meaning
i dont know where to put debug.log in that
The first line of the function
Log the tag of other
or that Debug.Log(other);
So you can see what tag it is
Did what
How would logging the word "other" print the tag of the other gameobject?
i didnt learn this stuff
im just going with what i learned in the unity course so far
Debug.Log(other.gameObject.tag);
this?
i think thats the one right
Debug.Log(other.gameObject.tag);
@hard nymph , it prints other when i hit a wall
Okay, so, what does it print when you hit the Finish line
other
So then it never hits something tagged "Finish"
So then why did you just say it prints "other"
Literally what does the Debug.Log print when you touch the finish line. That is all I need to know
other
Then either the thing you are hitting is not that object, or that object's tag changes
how can the thing im hitting not be the thing im hitting
You're hitting something tagged "other". That might not be the Landing Pad
okay hold on
try also logging the name of the object
Just like how you logged the tag, but name
Yes that is the object you hit
okay
also
unity crashed
wait
you want me to hit the finish line to see what it prints now.?
Yes. What does the console print when you hit the finish line
UnityEngine.Collision
So you didn't log the name of the object you hit
You just logged other
you told me to
No, I specifically said to log the name of it
see
The name
of the object
other is what you called the variable that stores the collision
Get the name of the object
just like how you got the tag of the object
get the name
what is the code for that
Look up how to get the name of an object in unity
No
That will just log the word "Landingpad"
You want to log the name of the object you hit
What if you hit something that isn't named "Landingpad"
You want to know what that is
im blanking here
So, you know how to get the object you hit. You use it to get the tag
Now, find out how to get the name of a game object
Log that
That'll print the object. That might work, but you should try printing the name of that
is there a code for that
Yes, look it up
like .name
please tell me
no
my chrome is laggy
why nottttt
because you need to learn to look things up
name of what
i duno google said taht on 3 sites
okay
you now know how to get the name of something
You also know how to get the object you want
Combine those two thoughts
What did the log look like in the end
Debug.Log(other.gameObject.name);
yes
Does it say "rocket" when you are expecting to hit the landing pad
okay let me try that
rocket
it says rocket
Then you are not touching the landing pad. you are touching rocket
Is this script on the thing you are controlling
So, OnCollisionEnter is checking collisions between this object and whatever it collides with
yeah
So, this object is the one with the script on it
whenever that object touches anything, OnCollisionEnter runs, and that other thing is put in the variable called other
So, other is rocket.
This object collided with rocket
yes
So, will whatever object this script is on ever collide with something tagged "Finish"?
i put the tags but i dont know
why it isnt tagged finish
in the code
Will whatever object this script is on, at any point, ever collide with an object that has the tag "Finish"
I'm not asking about code
I'm asking about your project
So, what prints when this object collides with something tagged "Finish"
other
Okay, and does the object named "other" have the tag "Finish"?
there is no object called other
Then how could it print "other" when you log the name of the object this script collided with
i have no idea
I asked you what it printed, you said "other". We are printing the name of the object
So there is an object named "other" or you are lying to me
Okay, show it printing "other"
okay
one second
mac slow
im confused now
it says player
when i ut
Debug.Log(other.gameObject.tag);
also ill be back in 5 - 10 minutes
So then it's hitting something tagged "Player" which seems consistent with the "Rocket" it printed before
At what point in the game is the object with this script supposed to collide with something tagged "Finish"
when it hits the finish line
So, the object this script is on touches the finish line
I am asking you, when does the object with this script on it touch something tagged "Finish"
it doesnt
uh
wait
So then this code never runs and it's pointless to check for it
i cant acutally put the script on the player
If this object is not meant to hit something tagged "Finish" then there's no point checking for it to
cause then it infinitely resets the level
So then maybe try to solve that problem
The realization I've been trying to lead you to is that if your script is on the finish line then it can never touch the finish line
An object cannot collide with itself
unity hasnt really been very friendly to me
thank you
for your help
ill try to fix my script
how long have you programmed for?
just checking
A while