#What s wrong in my script ?

1 messages · Page 1 of 1 (latest)

thorn heart
#

Hello!
I made this code with a video but I think there is a problem.
The output say an error message

Can someone help me please ?
(and idk where can I ask questions)
thanks !

distant meteorBOT
thorn heart
#

euh..

glad escarp
#

seems like you haven't accurately followed the tutorial

#

the linearvelocity of a rb2d is a Vector2, it has 2 floats inside, you can't use it as if it were just 1 float
the angularvelocity of an rb2d is a single float, you can't use it as if it were 3 floats as a Vector3

thorn heart
#

in the tutorial there was just "velocity" bur visual studio says it s obsolete

glad escarp
#

velocity was renamed to linearVelocity in unity 6

#

so anywhere you see rb.velocity in the tutorial, use rb.linearVelocity instead

#

but you still have to follow the tutorial accurately aside from that

thorn heart
#

here is the tutorial

thorn heart
#

there is another problem:

glad escarp
glad escarp
thorn heart
#

ah

#

no but just rb.velocity is obsolete

#

so i changed with linearVelocity

#

i dont understand what s wrong

#

and the prbleme apears when i change rb.velocity

glad escarp
#

you used linearVelocityY

thorn heart
#

ah

#

yes because in the tutorial it s rb.velocity.y

#

i have to remove the Y ?

glad escarp
#

one line has rb.velocity.y, the other line has just rb.velocity

thorn heart
#

okkkkkk thanks

#

i m just blind

#

wait

#

huum...

glad escarp
#

the tutorial:

#

you gotta pay more attention to the specifics here

thorn heart
#

okk

#

and it works !!!