Exemple #1
0
        public Physical3DCapsuleComponent(INode node, IPhysicsEngine physicsEngine) : base(node, physicsEngine)
        {
            _radius = 1f;
            _length = 1f;
            UpdateRigidBodyShape();

            Enabled = true;
        }
        public Physical3DCapsuleComponent(INode node, IPhysicsEngine physicsEngine) : base(node, physicsEngine)
        {
            _radius = 1f;
            _length = 1f;
            UpdateRigidBodyShape();

            Enabled = true;
        }
Exemple #3
0
        /// <summary>
        /// Alustaa uuden fysiikkapelin.
        /// </summary>
        public PhysicsGameBase(IPhysicsEngine engine)
            : base()
        {
            this.Engine    = engine;
            PhysicsEnabled = true;

            Joints.ItemAdded   += OnJointAdded;
            Joints.ItemRemoved += OnJointRemoved;
        }
Exemple #4
0
        protected PhysicalBaseRigidBodyComponent(INode node, IPhysicsEngine physicsEngine)
        {
            _node           = node;
            _physicsEngine  = physicsEngine;
            _addedRigidBody = false;

            Enabled   = true;
            Transform = new DefaultTransform();
        }
Exemple #5
0
 public PhysicsMetricsProfilerVisualiser(
     IAssetManagerProvider assetManagerProvider,
     I2DRenderUtilities renderUtilities,
     IPhysicsEngine physicsEngine)
 {
     _renderUtilities = renderUtilities;
     _physicsEngine   = physicsEngine;
     _defaultFont     = assetManagerProvider.GetAssetManager().Get <FontAsset>("font.Default");
 }
 public PhysicsMetricsProfilerVisualiser(
     IAssetManagerProvider assetManagerProvider,
     I2DRenderUtilities renderUtilities,
     IPhysicsEngine physicsEngine)
 {
     _renderUtilities = renderUtilities;
     _physicsEngine = physicsEngine;
     _defaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default");
 }
        public Physical3DCubeComponent(INode node, IPhysicsEngine physicsEngine) : base(node, physicsEngine)
        {
            Transform.Modified += (sender, args) =>
            {
                UpdateRigidBodyShape();
            };
            UpdateRigidBodyShape();

            Enabled = true;
        }
        public Physical3DCubeComponent(INode node, IPhysicsEngine physicsEngine) : base(node, physicsEngine)
        {
            Transform.Modified += (sender, args) =>
            {
                UpdateRigidBodyShape();
            };
            UpdateRigidBodyShape();

            Enabled = true;
        }
Exemple #9
0
        public Game(IGameBoundaries boundaries)
        {
            _inputManager  = boundaries.InputManager;
            _logger        = boundaries.Logger;
            _physicsEngine = boundaries.PhysicsEngine;
            _renderer      = boundaries.Renderer;
            _worldLoader   = boundaries.WorldLoader;
            _eventBus      = boundaries.EventBus;

            World = _worldLoader.LoadWorld();
        }
        public DefaultPhysicsWorldControl(IPhysicsEngine physicsEngine)
        {
            _physicsEngine = physicsEngine;

            _pendingSpeculativeContacts              = null;
            _pendingGravity                          = null;
            _pendingCoefficientMixingType            = null;
            _pendingConsiderAngularVelocityCallback  = null;
            _pendingCalculateStaticFrictionCallback  = null;
            _pendingCalculateDynamicFrictionCallback = null;
            _pendingCalculateRestitutionCallback     = null;
        }
 public InspectorGameHostExtension(
     [Optional] IPhysicsEngine physicsEngine,
     IDebugRenderer debugRenderer,
     InspectorRenderPass inspectorRenderPass,
     IConsoleHandle consoleHandle)
 {
     _physicsEngine       = physicsEngine;
     _debugRenderer       = debugRenderer;
     _inspectorRenderPass = inspectorRenderPass;
     _consoleHandle       = consoleHandle;
     _rigidBodyRef        = new WeakReference <RigidBody>(null);
 }
Exemple #12
0
 public GameEngine(IObservableTimer timer, IMessageBus bus, IGameObjectFactory factory, IGraphicsEngine graphics,
                   IAudioEngine audio, IPhysicsEngine physics)
 {
     Timer = timer;
     Bus = bus;
     Graphics = graphics;
     Audio = audio;
     Physics = physics;
     Factory = factory;
     Bus.Add(new DebugMessage(Timer.LastTickTime, "Initialising Engines"));
     Bus.OfType<ExitGameRequest>().Subscribe(m => Stop());
     Timer.Subscribe(Update);
     Timer.SubSample(5).Subscribe(t => bus.SendAll());
     Running = false;
 }
        public FirstPersonControllerPhysicsComponent(
            IPhysicsEngine physicsEngine,
            IDebugRenderer debugRenderer,
            [FromParent, RequireExisting] IPhysicalComponent physicalComponent)
        {
            _physicsEngine     = physicsEngine;
            _debugRenderer     = debugRenderer;
            _physicalComponent = physicalComponent;

            TargetVelocity = Vector3.Zero;
            TryJump        = false;
            JumpVelocity   = 0.5f;
            Stiffness      = 0.02f;

            Enabled = true;
        }
        public FirstPersonControllerPhysicsComponent(
            IPhysicsEngine physicsEngine,
            IDebugRenderer debugRenderer,
            [FromParent, RequireExisting] IPhysicalComponent physicalComponent)
        {
            _physicsEngine = physicsEngine;
            _debugRenderer = debugRenderer;
            _physicalComponent = physicalComponent;

            TargetVelocity = Vector3.Zero;
            TryJump = false;
            JumpVelocity = 0.5f;
            Stiffness = 0.02f;

            Enabled = true;
        }
        public MechanicEngine(
            IPhysicsEngine physicalEngine,
            IMapEngine mapEngine,
            IBodyBuilder bodyBuilder,
            IActiveBodyEyesight viewPort,
            IGameLevelRepository gameLevelRepository,
            ILogger logger,
            IUnityContainer unityContainer,
            Action <IPlayerBodyFacade> playerStateHandler
            )
        {
            _logger              = logger;
            _physicalEngine      = physicalEngine;
            _mapEngine           = mapEngine;
            _bodyBuilder         = bodyBuilder;
            _gameLevelRepository = gameLevelRepository;
            _unityContainer      = unityContainer;
            _playerStateHandler  = playerStateHandler;

            ViewPort = viewPort;
            Services = new List <IMechanicService>();

            BuildPhysicsResultHandlers();
        }
Exemple #16
0
 public GameEngine(IPhysicsEngine physicsEngine, ISurfaceManager surfaceManager, IEventTriggerer eventTriggerer)
 {
     _physicsEngine = physicsEngine;
     _surfaceManager = surfaceManager;
     _eventTriggerer = eventTriggerer;
 }
Exemple #17
0
 public PhysicsEngineHook(IPhysicsEngine physicsEngine, IPhysicsWorldControl physicsWorldControl)
 {
     _physicsEngine       = physicsEngine;
     _physicsWorldControl = physicsWorldControl;
 }
Exemple #18
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_scheduler = m_scene.Simian.GetAppModule<IScheduler>();
            if (m_scheduler == null)
            {
                m_log.Error("Inventory requires an IScheduler");
                return;
            }

            m_inventoryClient = m_scene.Simian.GetAppModule<IInventoryClient>();
            if (m_inventoryClient == null)
            {
                m_log.Error("Inventory requires an IInventoryClient");
                return;
            }

            m_assetClient = m_scene.Simian.GetAppModule<IAssetClient>();
            if (m_assetClient == null)
            {
                m_log.Error("Inventory requires an IAssetClient");
                return;
            }

            m_primMesher = m_scene.GetSceneModule<IPrimMesher>();
            if (m_primMesher == null)
            {
                m_log.Error("Inventory requires an IPrimMesher");
                return;
            }

            m_physics = m_scene.GetSceneModule<IPhysicsEngine>();
            m_permissions = m_scene.GetSceneModule<LLPermissions>();

            m_udp = m_scene.GetSceneModule<LLUDP>();
            if (m_udp != null)
            {
                m_udp.AddPacketHandler(PacketType.CreateInventoryItem, CreateInventoryItemHandler);
                m_udp.AddPacketHandler(PacketType.CreateInventoryFolder, CreateInventoryFolderHandler);
                m_udp.AddPacketHandler(PacketType.UpdateInventoryItem, UpdateInventoryItemHandler);
                m_udp.AddPacketHandler(PacketType.UpdateInventoryFolder, UpdateInventoryFolderHandler);
                m_udp.AddPacketHandler(PacketType.FetchInventoryDescendents, FetchInventoryDescendentsHandler);
                m_udp.AddPacketHandler(PacketType.FetchInventory, FetchInventoryHandler);
                m_udp.AddPacketHandler(PacketType.CopyInventoryItem, CopyInventoryItemHandler);
                m_udp.AddPacketHandler(PacketType.MoveInventoryItem, MoveInventoryItemHandler);
                m_udp.AddPacketHandler(PacketType.MoveInventoryFolder, MoveInventoryFolderHandler);
                m_udp.AddPacketHandler(PacketType.RemoveInventoryItem, RemoveInventoryItemHandler);
                m_udp.AddPacketHandler(PacketType.RemoveInventoryFolder, RemoveInventoryFolderHandler);
                m_udp.AddPacketHandler(PacketType.PurgeInventoryDescendents, PurgeInventoryDescendentsHandler);
                m_udp.AddPacketHandler(PacketType.DeRezObject, DeRezObjectHandler);
                m_udp.AddPacketHandler(PacketType.RezObject, RezObjectHandler);
                m_udp.AddPacketHandler(PacketType.LinkInventoryItem, LinkInventoryItemHandler);
            }
        }
        /*
        public TestGameEngine()
            : base(new AsyncObservableTimer(), new MessageBus(), new TestFactory(), new TestGraphics(), new TestAudio(), new TestPhysics())
        {
            Bus.OfType<GraphicsReady>().Subscribe(Start);
        }

        private void Start(GraphicsReady m)
        {
            Bus.Add(new DebugMessage(Timer.LastTickTime, "Starting Game"));

            for (int y = 0; y < 2; y++)
            for (int x = 0; x < 3; x++)
            {
                Bus.Add(new GameObjectRequest(m.TimeSent, new TestGameObject(Bus), new Vect3(3 * x, 3 * y , 0)));
            }

            var testGameObject = new TestGameObject(Bus);
            Bus.Add(new GameObjectRequest(m.TimeSent, testGameObject, new Vect3(-11, -1, 0)));
            Bus.Add(new SetVelocity(Timer.LastTickTime, testGameObject, new Vect3(3, 0, 0)));
        }
         * */
        public TestGameEngine(IObservableTimer timer, IMessageBus bus, IGameObjectFactory factory, IGraphicsEngine graphics, IAudioEngine audio, IPhysicsEngine physics)
            : base(timer, bus, factory, graphics, audio, physics)
        {
        }
Exemple #20
0
 public GameEngine(IPhysicsEngine physicsEngine, IEventManager eventManager)
 {
     _physicsEngine = physicsEngine;
     EventManager = eventManager;
 }
Exemple #21
0
 public PhysicsEngineHook(IPhysicsEngine physicsEngine)
 {
     _physicsEngine = physicsEngine;
 }
Exemple #22
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            m_primMesher = m_scene.GetSceneModule<IPrimMesher>();
            if (m_primMesher == null)
            {
                m_log.Error("Objects requires an IPrimMesher");
                return;
            }

            m_permissions = m_scene.GetSceneModule<LLPermissions>();
            if (m_permissions == null)
            {
                m_log.Error("Objects requires LLPermissions");
                return;
            }

            // Optional modules
            m_physics = m_scene.GetSceneModule<IPhysicsEngine>();
            m_lslScriptEngine = m_scene.GetSceneModule<ILSLScriptEngine>();
            m_inventory = m_scene.GetSceneModule<Inventory>();

            // Collision handler
            if (m_physics != null && m_lslScriptEngine != null)
            {
                m_physics.OnEntityCollision += EntityCollisionHandler;
            }

            m_udp = m_scene.GetSceneModule<LLUDP>();
            if (m_udp != null)
            {
                m_udp.AddPacketHandler(PacketType.ObjectAdd, ObjectAddHandler);
                m_udp.AddPacketHandler(PacketType.ObjectAttach, ObjectAttachHandler);
                m_udp.AddPacketHandler(PacketType.ObjectDrop, ObjectDropHandler);
                m_udp.AddPacketHandler(PacketType.ObjectDuplicate, ObjectDuplicateHandler);
                m_udp.AddPacketHandler(PacketType.ObjectName, ObjectNameHandler);
                m_udp.AddPacketHandler(PacketType.ObjectSelect, ObjectSelectHandler);
                m_udp.AddPacketHandler(PacketType.ObjectDeselect, ObjectDeselectHandler);
                m_udp.AddPacketHandler(PacketType.ObjectGrab, ObjectGrabHandler);
                m_udp.AddPacketHandler(PacketType.ObjectGrabUpdate, ObjectGrabUpdateHandler);
                m_udp.AddPacketHandler(PacketType.ObjectDeGrab, ObjectDeGrabHandler);
                m_udp.AddPacketHandler(PacketType.ObjectLink, ObjectLinkHandler);
                m_udp.AddPacketHandler(PacketType.ObjectDelink, ObjectDelinkHandler);
                m_udp.AddPacketHandler(PacketType.ObjectShape, ObjectShapeHandler);
                m_udp.AddPacketHandler(PacketType.ObjectFlagUpdate, ObjectFlagUpdateHandler);
                m_udp.AddPacketHandler(PacketType.ObjectExtraParams, ObjectExtraParamsHandler);
                m_udp.AddPacketHandler(PacketType.ObjectImage, ObjectImageHandler);
                m_udp.AddPacketHandler(PacketType.ObjectPermissions, ObjectPermissionsHandler);
                m_udp.AddPacketHandler(PacketType.Undo, UndoHandler);
                m_udp.AddPacketHandler(PacketType.Redo, RedoHandler);
                m_udp.AddPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjectUpdateHandler);
                m_udp.AddPacketHandler(PacketType.RequestObjectPropertiesFamily, RequestObjectPropertiesFamilyHandler);

                m_scene.AddInterestListHandler(OBJECT_UPDATE, new InterestListEventHandler { CombineCallback = ObjectUpdateCombiner, SendCallback = SendEntityPackets });
                m_scene.AddInterestListHandler(OBJECT_REMOVE, new InterestListEventHandler { CombineCallback = ObjectUpdateCombiner, SendCallback = SendKillPacket });

                m_scene.OnEntityAddOrUpdate += EntityAddOrUpdateHandler;
                m_scene.OnEntityRemove += EntityRemoveHandler;
                m_scene.OnPresenceAdd += PresenceAddHandler;
            }

            m_proxyPrim = new Primitive();
            m_proxyPrim.PrimData = ObjectManager.BuildBasicShape(PrimType.Box);
        }
 public PhysicalBatchedStaticCompoundComponent(INode node, IPhysicsEngine physicsEngine, CompoundShape shape) : base(node, physicsEngine)
 {
     _shape = shape;
 }
Exemple #24
0
        public void Start(IScene scene)
        {
            m_scene = scene;

            // Get our process ID, used in the SimStats packet
            m_pid = Process.GetCurrentProcess().Id;

            m_regionInfo = m_scene.GetSceneModule<RegionInfo>();
            m_physics = m_scene.GetSceneModule<IPhysicsEngine>();

            m_udp = m_scene.GetSceneModule<LLUDP>();
            if (m_udp != null)
            {
                InitializeStatsPacket();
                m_scene.Simian.AddHeartbeatHandler(SendSimStats);
            }
        }
 public PhysicalBatchedStaticCompoundComponent(INode node, IPhysicsEngine physicsEngine, CompoundShape shape) : base(node, physicsEngine)
 {
     _shape = shape;
 }
Exemple #26
0
        public RoomEditorWorld(
            IFactory factory, 
            I2DRenderUtilities twoDRenderUtilities, 
            IAssetManagerProvider assetManagerProvider, 
            IPhysicsEngine physicsEngine, 
            IRoomTool[] roomTools,
            ShipEditorWorld previousWorld,
            Room room)
        {
            this.PreviousWorld = previousWorld;
            this.Entities = new List<IEntity>();

            this.m_2DRenderUtilities = twoDRenderUtilities;
            this.m_AssetManager = assetManagerProvider.GetAssetManager();
            this.m_RoomTools = roomTools;
            this.m_DefaultFont = this.m_AssetManager.Get<FontAsset>("font.Default");
            this.m_LightingEffect = this.m_AssetManager.Get<EffectAsset>("effect.Light");

            this.m_LightingEffect.Effect.Parameters["Ambient"].SetValue(new Vector3(0.2f, 0.2f, 0.2f));
            this.m_LightingEffect.Effect.Parameters["AmbientRemaining"].SetValue(new Vector3(0.8f, 0.8f, 0.8f));

            var ship = factory.CreateShipEntity();
            var player = factory.CreatePlayerEntity();
            player.ParentArea = ship;
            player.X = 5;
            player.Z = 5;

            this.m_Room = room;
            foreach (var obj in this.m_Room.Objects)
            {
                obj.Reinitalize();
            }

            this.m_RoomEditorEntity = factory.CreateRoomEditorEntity(this.m_Room);

            this.Entities.Add(ship);
            this.Entities.Add(player);

            this.Entities.Add(this.m_RoomEditorEntity);

            this.m_PhysicsEngine = physicsEngine;

            this.m_JitterWorld = new JitterWorld(
                new CollisionSystemSAP
                {
                    EnableSpeculativeContacts = true
                })
            {
                Gravity = new JVector(0, -50, 0)
            };

            this.m_JitterWorld.ContactSettings.MaterialCoefficientMixing =
                ContactSettings.MaterialCoefficientMixingType.TakeMinimum;

            var shape = new BoxShape(new JVector(2, 2, 2));
            var body = new RigidBody(shape);
            this.m_JitterWorld.AddBody(body);
            body.Position = new JVector(20, 10, 20);
            body.IsActive = true;
            this.m_RigidBody = body;

            this.SetupRoomPhysics();
        }