private ActorNode BuildStep( Framework.Parts.IActor actor )
        {
            if (actor != null)
            {
                ActorNode newNode = new ActorNode();

                newNode.Text        = actor.Name;
                newNode.ToolTipText = actor.TypeName;
                newNode.Actor       = actor;

                Framework.Parts.IActorCollection collection = actor.QueryInterface<Framework.Parts.IActorCollection>();

                if (collection != null)
                {
                    foreach (Framework.Parts.IActor a in collection)
                    {
                        newNode.Nodes.Add(BuildStep(a));
                    }
                }

                return newNode;
            }
            return null;
        }
Example #2
0
        public override void Spawn(Vector3 position, Quaternion orientation)
        {
            // create scene node
            SceneNode sceneNode = this.CreateSceneNode(position, orientation);
            Entity entity = sceneNode.GetAttachedObject(0) as Entity;

            // physics
            BodyDesc bodyDesc = new BodyDesc();
            bodyDesc.LinearVelocity = this.Velocity;

            ActorDesc actorDesc = Engine.Physics.CreateActorDesc(this, entity, position, orientation, this.Scale);
            actorDesc.Density = this.Density;
            actorDesc.Body = bodyDesc;
            actorDesc.GlobalPosition = position;
            actorDesc.GlobalOrientation = orientation.ToRotationMatrix();

            if (this.EnableCCD)
            {
                foreach (ShapeDesc shapeDesc in actorDesc.Shapes)
                    shapeDesc.ShapeFlags = ShapeFlags.DynamicDynamicCCD;
            }

            Actor actor = Engine.Physics.Scene.CreateActor(actorDesc);
            actor.UserData = this;

            ActorNode actorNode = new ActorNode(sceneNode, actor);
            Engine.World.ActorNodes.Add(actorNode);
        }