Fix move_and_collide causing sliding on slopes
Make sure the direction of the motion is preserved, unless the depth is higher than the margin, which means the body needs depenetration in any direction. Also changed move_and_slide to avoid sliding on the first motion, in order to avoid issues with unstable position on ground when jumping. Co-authored-by: fabriceci <fabricecipolla@gmail.com>
This commit is contained in:
@ -469,6 +469,9 @@ public:
|
||||
Vector2 collision_point;
|
||||
Vector2 collision_normal;
|
||||
Vector2 collider_velocity;
|
||||
real_t collision_depth = 0.0;
|
||||
real_t collision_safe_fraction = 0.0;
|
||||
real_t collision_unsafe_fraction = 0.0;
|
||||
int collision_local_shape = 0;
|
||||
ObjectID collider_id = 0;
|
||||
RID collider;
|
||||
@ -594,6 +597,9 @@ public:
|
||||
RID get_collider_rid() const;
|
||||
Object *get_collider() const;
|
||||
int get_collider_shape() const;
|
||||
real_t get_collision_depth() const;
|
||||
real_t get_collision_safe_fraction() const;
|
||||
real_t get_collision_unsafe_fraction() const;
|
||||
};
|
||||
|
||||
typedef Physics2DServer *(*CreatePhysics2DServerCallback)();
|
||||
|
||||
Reference in New Issue
Block a user