Esempio n. 1
0
 public void LoadScenarioObjectCollision(ScenarioObject scenarioObject)
 {
     for (var index = 0; index < scenarioObject.Nodes.Count; index++)
     {
         var node            = scenarioObject.Nodes[index];
         var collisionObject = new ScenarioCollisionObject
         {
             CollisionShape = new BoxShape(0.015f),
             WorldTransform = scenarioObject.Nodes.GetWorldMatrix(node),
             UserObject     = node,
             ParentObject   = scenarioObject
         };
         node.CollisionObject = collisionObject;
         World.AddCollisionObject(collisionObject);
     }
     foreach (var collisionObject in scenarioObject.Markers.Select(marker => new ScenarioCollisionObject
     {
         CollisionShape = new BoxShape(0.015f),
         WorldTransform = Matrix4.CreateFromQuaternion(marker.Rotation) *
                          Matrix4.CreateTranslation(marker.Translation) *
                          scenarioObject.Nodes.GetWorldMatrix(marker.NodeIndex),
         UserObject = marker,
         ParentObject = scenarioObject
     }))
     {
         World.AddCollisionObject(collisionObject, (short)CollisionGroup.Objects, (short)(CollisionGroup.Objects | CollisionGroup.Level));
     }
 }
Esempio n. 2
0
 internal void Add(TagIdent ident, ScenarioObject @object)
 {
     objectInstances.Add(ident, @object);
 }