Esempio n. 1
0
        public KinematicCollision2D MoveObject(KinematicBody2D host, Vector2 direction)
        {
            Vector2 velocity = direction.Normalized() * Speed;

            host.MoveAndSlide(velocity, Vector2.Zero);
            return(host.GetSlideCount() == 0 ? null : host.GetSlideCollision(0));
        }
Esempio n. 2
0
        /// <summary>
        ///     Return all collider since last movement.
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <KinematicCollision2D> GetCollider(this KinematicBody2D kinematicBody2D)
        {
            var collider = new List <KinematicCollision2D>();

            for (var i = 0; i < kinematicBody2D.GetSlideCount(); i++)
            {
                var coll = kinematicBody2D.GetSlideCollision(i);
                collider.Add(coll);
            }

            return(collider);
        }