|
|
|
|
Reply From: |
kidscancode |
move_and_collide()
is the basic movement method for kinematic bodies. It attempts to move the body along the given vector, stopping if it collides with another body. If a collision happens, it returns a collision object containing the details.
move_and_slide()
was designed as a special case, because a common use case was to calculate a slide vector along the collision. However, because it slides, it’s possible for there to be more than one collision in a frame (think when you hit a corner between the floor and the wall. For this reason, it can’t return a collision, so you need to use the get_slide_collision()
method to retrieve the details. Fun fact: move_and_slide()
calls move_and_collide()
internally to process the movement.
Both take a vector for the movement, but move_and_collide()
, being the more basic method, is just the frame-based (ie multiplied by delta
) movement vector. move_and_slide()
, however, takes the pre-delta velocity (yes, this can be confusing).
Hopefully that clarifies it at least somewhat questions 1-3.
As for #4, what is melting your brain about vectors? Have you read this:
Vector math — Godot Engine (3.0) documentation in English ? I think it’s a pretty good overview of the topic specifically applied to its use in games.
Thanks for your answer
So, as to 1) … Relative vs. Linear is “Vector3*delta” vs. just “Vector3” … Both are “Relative to Frame-time”? … If so, I think the chosen nomenclature is somewhat confusing
Just to clarify:
move_and_collide()
should be fed a pre-multiplied velocity Vector3 (Vector3*delta).
move_and_slide()
should be fed a raw velocity Vector3, and does the delta internally.
And yes, I have read the tutorial on vector-math, along with several other resources on the subject … Still I’m having troubles
PS: the most helpful info I got from you answer, is the fact that move_and_slide()
calls move_and_collide()
internally … that helps my understanding of what really is going on.