#ill try

1 messages · Page 1 of 1 (latest)

hard nymph
#

Show the code as it currently is, with the debug logs intact

iron spoke
#

okay

#

ops

#

wait

#

this one

hard nymph
#

I said to log the tag as the first line of the function

#

Not inside the switch

iron spoke
#

i thought you wanted to see if it prints on finish line

hard nymph
#

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

iron spoke
#

where do i put that

#

im noob sorry

hard nymph
#

The first line of OnCollision

iron spoke
#

Debug.Log(void OnCollisionEnter(Collision other))

#

like that?

hard nymph
#

No, just log the tag of the other object as the first line of your function

iron spoke
#

other object meaning

hard nymph
#

The thing you collided with

#

Literally named "other"

iron spoke
#

i dont know where to put debug.log in that

hard nymph
#

The first line of the function

iron spoke
#

ok

#

Debug.Log("other");

#

that

hard nymph
#

Log the tag of other

iron spoke
#

or that Debug.Log(other);

hard nymph
#

So you can see what tag it is

iron spoke
#

i

#

i just did that doe

#

i

hard nymph
#

Did what

iron spoke
#

doesnt this work?

#

Debug.Log("other");

hard nymph
#

How would logging the word "other" print the tag of the other gameobject?

iron spoke
#

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

hard nymph
#

Okay, so, what does it print when you hit the Finish line

iron spoke
#

other

hard nymph
#

So then it never hits something tagged "Finish"

iron spoke
#

wel

#

the finish line says "Finish"

#

as a tag

#

but doesnt show it

hard nymph
iron spoke
#

i meant

#

it says that in inspector

#

as a tag

#

but when i hit it

#

it says other

hard nymph
#

Literally what does the Debug.Log print when you touch the finish line. That is all I need to know

iron spoke
#

other

hard nymph
#

Then the thing you hit has the tag "other"

#

not "Finish"

iron spoke
hard nymph
#

Then either the thing you are hitting is not that object, or that object's tag changes

iron spoke
#

how can the thing im hitting not be the thing im hitting

hard nymph
hard nymph
#

try also logging the name of the object

iron spoke
#

okay

#

how do i do that

hard nymph
#

Just like how you logged the tag, but name

iron spoke
#

okay

#

Debug.Log(Finish);

#

like taht

hard nymph
#

No

#

Log the name of the object you hit

iron spoke
#

okay

#

it is that

#

oh you mean other?

hard nymph
#

Yes that is the object you hit

iron spoke
#

okay

#

also

#

unity crashed

#

wait

#

you want me to hit the finish line to see what it prints now.?

hard nymph
#

Yes. What does the console print when you hit the finish line

iron spoke
#

UnityEngine.Collision

hard nymph
#

You just logged other

iron spoke
#

you told me to

hard nymph
#

No, I specifically said to log the name of it

iron spoke
hard nymph
iron spoke
#

what do you mean name

#

isnt other the name

hard nymph
#

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

iron spoke
#

what is the code for that

hard nymph
#

Look up how to get the name of an object in unity

iron spoke
#

okay

#

Debug.Log('Landingpad');

#

that

hard nymph
#

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

iron spoke
#

im blanking here

hard nymph
#

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

iron spoke
#

Debug.Log(other.gameObject);

#

that

hard nymph
#

That'll print the object. That might work, but you should try printing the name of that

iron spoke
#

is there a code for that

hard nymph
#

Yes, look it up

iron spoke
#

like .name

iron spoke
hard nymph
iron spoke
#

my chrome is laggy

iron spoke
hard nymph
iron spoke
#

okay

#

wait

#

Debug.Log(name);

#

that

hard nymph
#

name of what

iron spoke
#

i duno google said taht on 3 sites

hard nymph
#

So think

#

don't just copy paste code

#

understand things and synthesize new thoughts

iron spoke
#

okay

hard nymph
#

you now know how to get the name of something

#

You also know how to get the object you want

#

Combine those two thoughts

iron spoke
#

rocket

#

it says rocket

#

when i run this code

hard nymph
#

What did the log look like in the end

iron spoke
hard nymph
#

Then you collided with something named "rocket"

#

That is the correct log

iron spoke
#

yes

hard nymph
#

Does it say "rocket" when you are expecting to hit the landing pad

iron spoke
#

rocket

#

it says rocket

hard nymph
#

Then you are not touching the landing pad. you are touching rocket

iron spoke
#

im controlling rocket

#

how can that be

hard nymph
iron spoke
#

no

#

when it is, it keeps on resetting the game

hard nymph
#

So, OnCollisionEnter is checking collisions between this object and whatever it collides with

iron spoke
#

yeah

hard nymph
#

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

iron spoke
#

yes

hard nymph
#

So, will whatever object this script is on ever collide with something tagged "Finish"?

iron spoke
#

why it isnt tagged finish

#

in the code

hard nymph
#

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

iron spoke
#

yes

#

it does yes

hard nymph
#

So, what prints when this object collides with something tagged "Finish"

iron spoke
#

other

hard nymph
#

Okay, and does the object named "other" have the tag "Finish"?

iron spoke
#

there is no object called other

hard nymph
iron spoke
#

i have no idea

hard nymph
#

I asked you what it printed, you said "other". We are printing the name of the object

iron spoke
#

there no such gameobject

#

as other

hard nymph
#

So there is an object named "other" or you are lying to me

iron spoke
#

wait

#

look

hard nymph
#

Okay, show it printing "other"

iron spoke
#

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

hard nymph
#

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"

hard nymph
iron spoke
#

huh?

#

oh oh

#

yes

#

it is

hard nymph
#

I am asking you, when does the object with this script on it touch something tagged "Finish"

hard nymph
iron spoke
#

i cant acutally put the script on the player

hard nymph
#

If this object is not meant to hit something tagged "Finish" then there's no point checking for it to

iron spoke
#

cause then it infinitely resets the level

hard nymph
iron spoke
#

ill try

#

im very stupid, thanks for your help

hard nymph
#

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

iron spoke
#

unity hasnt really been very friendly to me

iron spoke
#

for your help

#

ill try to fix my script

#

how long have you programmed for?

#

just checking

hard nymph
#

A while

iron spoke
#

ive been doing this for a month

#

chaotic

#

death

#

destruction

#

breakdowns