Пример #1
0
            public override void _Ready()
            {
                var carBase = new CarBase();

                AddChild(carBase);

                var carLeftWheel = new Wheel();

                carLeftWheel.Position = carBase.Position + new Vector2((-carBase.BodySize.x / 2) + carLeftWheel.Radius, carBase.BodySize.y);
                AddChild(carLeftWheel);
                var leftJoint = new PinJoint2D()
                {
                    NodeA    = carBase.GetPath(),
                    NodeB    = carLeftWheel.GetPath(),
                    Softness = 0
                };

                carLeftWheel.AddChild(leftJoint);

                var carRightWheel = new Wheel();

                carRightWheel.Position = carBase.Position + new Vector2((carBase.BodySize.x / 2) - carRightWheel.Radius, carBase.BodySize.y);
                AddChild(carRightWheel);
                var rightJoint = new PinJoint2D()
                {
                    NodeA    = carBase.GetPath(),
                    NodeB    = carRightWheel.GetPath(),
                    Softness = 0
                };

                carRightWheel.AddChild(rightJoint);
            }