Example #1
0
        private IKBone CreateBone(float thickness, float length, Color color)
        {
            var bone = new IKBone(length, null);

            var p = Program.Inst;
            var g = p.GraphicsDevice;

            var mesh = MeshGen.Disc(thickness, length + 0.05f)
                       .Translate(0.5f * length * Vector3.Up)
                       .Color(color);

            p.Scene.AddEntity(new EcsEntity(new CMesh   {
                Mesh = mesh.Gpu(g)
            },
                                            new CIKBone {
                Bone = bone
            },
                                            new CPos    {
            },
                                            // new CVel  { },
                                            new CRot {
            },
                                            new CShadow {
            }
                                            ));

            return(bone);
        }
Example #2
0
        public void AddBone(float length, Color?color = null, Vector3?pos = null, float thickness = 0.06f)
        {
            color = color ?? Color.Black;

            IKBone parent = null;

            if (mBones.Count > 0)
            {
                parent = mBones[mBones.Count - 1];
            }

            var bone = CreateBone(thickness, length, color.Value);

            if (parent == null)
            {
                bone.Pos = pos.Value;
            }
            else
            {
                bone.Parent = parent;
            }

            mBones.Add(bone);
        }
Example #3
0
 public IKBone(float length, IKBone parent)
 {
     Length = length;
     Parent = parent;
 }