Ejemplo n.º 1
0
        public override void Initialize(ContentArchive content, Camera camera)
        {
            camera.Position = new Vector3(130, 50, 130);
            camera.Yaw      = -MathF.PI * 0.25f;
            camera.Pitch    = 0.4f;

            characterControllers = new CharacterControllers(BufferPool);
            Simulation           = Simulation.Create(BufferPool, new CharacterNarrowphaseCallbacks(characterControllers), new DemoPoseIntegratorCallbacks(new Vector3(0, -10, 0)));

            DemoMeshHelper.LoadModel(content, BufferPool, @"Content\newt.obj", new Vector3(-10, 10, -10), out var newtMesh);
            var newtShape = Simulation.Shapes.Add(newtMesh);

            newts        = new QuickList <SponsorNewt>(sponsors2.Count, BufferPool);
            newtArenaMin = new Vector2(-100);
            newtArenaMax = new Vector2(100);
            random       = new Random(6);
            for (int i = 0; i < sponsors2.Count; ++i)
            {
                ref var newt = ref newts.AllocateUnsafely();
                newt = new SponsorNewt(Simulation, newtShape, 0, newtArenaMin, newtArenaMax, random, i);
            }
Ejemplo n.º 2
0
        public override void Initialize(ContentArchive content, Camera camera)
        {
            camera.Position = new Vector3(130, 50, 130);
            camera.Yaw      = -MathF.PI * 0.25f;
            camera.Pitch    = 0.4f;

            characterControllers = new CharacterControllers(BufferPool);
            //Using a PositionLastTimestepper since we control the newts by velocity. Not as critical since they're kinematic and the position targets won't seek to cause undesired penetrations anyway,
            //but it'll avoid integrating velocities into positions before the solver has a chance to intervene.
            Simulation = Simulation.Create(BufferPool, new CharacterNarrowphaseCallbacks(characterControllers), new DemoPoseIntegratorCallbacks(new Vector3(0, -10, 0)), new PositionLastTimestepper());

            DemoMeshHelper.LoadModel(content, BufferPool, @"Content\newt.obj", new Vector3(-10, 10, -10), out var newtMesh);
            var newtShape = Simulation.Shapes.Add(newtMesh);

            newts        = new QuickList <SponsorNewt>(sponsors2.Count, BufferPool);
            newtArenaMin = new Vector2(-100);
            newtArenaMax = new Vector2(100);
            random       = new Random(6);
            for (int i = 0; i < sponsors2.Count; ++i)
            {
                ref var newt = ref newts.AllocateUnsafely();
                newt = new SponsorNewt(Simulation, newtShape, 0, newtArenaMin, newtArenaMax, random, i);
            }