This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Can someone explain to me what slide vector function is used for?

mtuf1989mtuf1989 Posts: 3Member

I search and know about the code behind it, but what i want to know is its usage, some example would be great. Thanks in advance

Answers

  • 1000h1000h Posts: 133Member

    So I just learned what this is, I was curious too:

    You know when you run up against a wall in a video game, and then instead of just sticking into the wall, or bouncing off the wall, you slide one way or the other?

    This is what the slide function does

    So you would use it if you were writing some code that involved some body, maybe, but a vector, at least, coming into contact with a plane (assuming its in motion), and then you would say, when it hits the wall, slide along the direction of the wall, which off the top of my head seems like a vector perpendicular to the normal of the plane.

    I can see this being used in kinematic body, where kinematic body physics need to be written by the coder as constraints instead of just generated dynamically like rigid body.

    Anyway, I watched this talk and learned that:

    I think there is an example of slide in the kinematic body demo

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.