#Move and slide() doubt
17 messages · Page 1 of 1 (latest)
someone helps me with this, and if someone could explain me the function at detail
also collide = move and collide() why is it typed like that it kinda confuse me
It returns something and you want to use the returned value
What's confusing about it exactly?
Move and collide returns the colliding node, while move and slide returns the adjusted velocity due to sliding
You don't "need" to type it that way unless you plan to use the returned value
but why use returned value from moveandslide(movement)? why don't just use the movement variable value?
It won't "slide" otherwise?
no i mean, why moveandslide() returned a value where you can call it and leave it alone and you can just use the movement variable value if you'd like to use it
I've answered you several times now: "move and slide returns the adjusted velocity due to sliding". You use the returned value if you want to use the adjusted velocity from sliding.
Have you tried comparing it in your code? as I think you might better understand it in action; try it out!
Oh wait, so moveandslide(movement) doesn't return the value of movement variable just like as it was ? so it does return different value?
only if it actually "slides" (via collision)
i've try it on debugger
oh ok that's why i only seen the value of movement variable lol,my scene wasn't collide with anything
ok i understand now, thanks for the help
yep, give it a go with a few objects to collide with and watch the vector change 🙂