コード例 #1
0
ファイル: Physics.cs プロジェクト: solomondg/synthesis
        /// <summary>
        /// Tries to reset the robot
        /// </summary>
        public void ResetRobot()
        {
            if (Skeleton == null)
            {
                return;
            }

            List <BulletRigidNode> Wheels = new List <BulletRigidNode>();

            foreach (RigidNode_Base node in Skeleton.ListAllNodes())
            {
                BulletRigidNode bNode = (BulletRigidNode)node;

                if (bNode.BulletObject == null)
                {
                    continue;
                }

                WheelDriverMeta wheel;
                if ((wheel = bNode.GetSkeletalJoint()?.cDriver?.GetInfo <WheelDriverMeta>()) != null)
                {
                    Wheels.Add(bNode);
                }

                AuxFunctions.OrientRobot(Wheels, Skeleton.BulletObject);

                bNode.BulletObject.WorldTransform = Matrix4.CreateTranslation(0, 10, 0);
                bNode.BulletObject.InterpolationLinearVelocity  = Vector3.Zero;
                bNode.BulletObject.InterpolationAngularVelocity = Vector3.Zero;
            }
        }