protected override JobHandle OnUpdate(JobHandle inputDependencies)
        {
            m_ExportPhysicsWorldSystem.FinalJobHandle.Complete();

            NativeArray <ArchetypeChunk> chunks = m_motorQuery.CreateArchetypeChunkArray(Allocator.TempJob);

            ArchetypeChunkComponentType <KinematicMotor>  chunkKinematicMotorType  = GetArchetypeChunkComponentType <KinematicMotor>();
            ArchetypeChunkComponentType <Movement>        chunkMovementType        = GetArchetypeChunkComponentType <Movement>();
            ArchetypeChunkComponentType <PhysicsCollider> chunkPhysicsColliderType = GetArchetypeChunkComponentType <PhysicsCollider>();
            ArchetypeChunkComponentType <Translation>     chunkTranslationType     = GetArchetypeChunkComponentType <Translation>();
            ArchetypeChunkComponentType <Rotation>        chunkRotationType        = GetArchetypeChunkComponentType <Rotation>();

            MotorJob motorJob = new MotorJob
            {
                Chunks = chunks,

                World = m_buildPhysicsWorld.PhysicsWorld,

                DeltaTime = UnityEngine.Time.fixedDeltaTime,

                KinematicMotorType  = chunkKinematicMotorType,
                PhysicsColliderType = chunkPhysicsColliderType,
                MovementType        = chunkMovementType,
                TranslationType     = chunkTranslationType,
                RotationType        = chunkRotationType,

                DistanceHits           = new NativeArray <DistanceHit>(KinematicMotorUtilities.MAX_QUERIES, Allocator.TempJob),
                ColliderCastHits       = new NativeArray <ColliderCastHit>(KinematicMotorUtilities.MAX_QUERIES, Allocator.TempJob),
                SurfaceConstraintInfos = new NativeArray <SurfaceConstraintInfo>(KinematicMotorUtilities.MAX_QUERIES * 4, Allocator.TempJob)
            };

            inputDependencies = motorJob.Schedule(m_motorQuery, inputDependencies);

            return(inputDependencies);
        }
Exemplo n.º 2
0
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new MotorJob()
            {
                dt = Time.deltaTime
            };

            return(job.Schedule(this, inputDeps));
        }