Exemple #1
0
        public IKSolver GetIKArm()
        {
            ShaderInfo.Material characterMaterial;
            characterMaterial.Emissive  = new Color(0, 0, 0, 255);
            characterMaterial.Diffuse   = new Color(100, 150, 100, 255);
            characterMaterial.Specular  = new Color(255, 255, 255, 255);
            characterMaterial.Shininess = 0.8f;
            LightingInfo characterLighting = new LightingInfo("PlayerNormal", characterMaterial);

            Bone shoulder = new Bone("Shoulder", new Vector2(0), 0, new Vector2(0), new Vector2(-0.5f / 32f, 10.5f / 32f));          //Child connector is placed at location of shoulder

            Bone UpperArmFront = new Bone("UpperArm", new Vector2(0), 0, new Vector2(-0f / 32f, 5.5f / 32f), new Vector2(1.5f / 32f, -7.5f / 32f));

            UpperArmFront.Drawable            = new Drawable("Player", new Vector2(16), 32, 32, 64, 0, 0.11f);
            UpperArmFront.Drawable.ShaderInfo = characterLighting;
            shoulder.AddChild(UpperArmFront);
            Bone LowerArm = new Bone("LowerArm", new Vector2(0), 0, new Vector2(-0.5f / 32f, 7.5f / 32f), new Vector2(2.5f / 32f, -9.5f / 32f));

            LowerArm.Drawable            = new Drawable("Player", new Vector2(16), 32, 32, 0, 32, 0.12f);
            LowerArm.Drawable.ShaderInfo = characterLighting;
            UpperArmFront.AddChild(LowerArm);
            Bone Hand = new Bone("Hand", new Vector2(0), 0, new Vector2(0.5f / 32f, 2.5f / 32f), new Vector2(0.5f / 32f, -2.5f / 32f));

            Hand.Drawable            = new Drawable("Player", new Vector2(16), 32, 32, 32, 32, 0.12f);
            Hand.Drawable.ShaderInfo = characterLighting;
            LowerArm.AddChild(Hand);

            IKSolver armSolver = new IKSolver();

            armSolver.MountId = "PlayerLegs";
            armSolver.Root    = shoulder.Copy();

            return(armSolver);
        }