コード例 #1
0
        public static Fix64Vec3 MulT(Fix64Vec3 pos, Fix64Quat rot, Fix64Vec3 point)
        {
            Fix64Vec3 output = Fix64Vec3.zero;

            NativeParallel3D.MulT(pos, rot, point, ref output);
            return(output);
        }
コード例 #2
0
        public Fix64 Length()
        {
            Fix64 result = Fix64.zero;

            NativeParallel3D.Vec3Length64(this, ref result);
            return(result);
        }
コード例 #3
0
        public static bool OverlapCube(Fix64Vec3 center, Fix64Quat rotation, Fix64 x, Fix64 y, Fix64 z, int mask, PShapeOverlapResult3D shapeOverlapResult)
        {
            if (!initialized)
            {
                Initialize();
            }

            int  count = 0;
            bool hit   = NativeParallel3D.CubeOverlap(internalWorld.IntPointer, mask, center, rotation, x, y, z, _queryBodyIDs, ref count);

            shapeOverlapResult.count = count;

            for (int i = 0; i < count; i++)
            {
                UInt16 bodyID = _queryBodyIDs[i];
                if (bodyDictionary.ContainsKey(bodyID))
                {
                    shapeOverlapResult.rigidbodies[i] = bodyDictionary[bodyID].RigidBody;
                }
                else
                {
                    Debug.LogError($"Rigibody not found: {bodyID}");
                }
            }

            return(hit);
        }
コード例 #4
0
        public static ParallelQHullData ConvextHull3D(Fix64Vec3[] verts, UInt32 count, bool simplify, Fix64 rad)
        {
            if (!initialized)
            {
                Initialize();
            }

            UInt32 outCount = 1024 * 10;

            Fix64Vec3[]     vertsOut  = new Fix64Vec3[outCount];
            ParallelEdge[]  edgesOut  = new ParallelEdge[outCount];
            ParallelFace[]  facesOut  = new ParallelFace[outCount];
            ParallelPlane[] planesOut = new ParallelPlane[outCount];

            UInt32 vertsOutCount = outCount;
            UInt32 edgesOutCount = outCount;
            UInt32 facesOutCount = outCount;

            NativeParallel3D.ConvexHull3D(verts, count, vertsOut, ref vertsOutCount, edgesOut, ref edgesOutCount, facesOut, ref facesOutCount, planesOut, simplify, rad);

            ParallelQHullData parallelQHullData = new ParallelQHullData();

            parallelQHullData.vertexCount = vertsOutCount;
            parallelQHullData.edgeCount   = edgesOutCount;
            parallelQHullData.faceCount   = facesOutCount;
            parallelQHullData.vertices    = vertsOut;
            parallelQHullData.edges       = edgesOut;
            parallelQHullData.faces       = facesOut;
            parallelQHullData.planes      = planesOut;
            return(parallelQHullData);
        }
コード例 #5
0
        public static void SetFixtureProperties(PFixture3D fixture, bool isTrigger, Fix64 friction, Fix64 bounciness)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.SetFixtureProperties(fixture.IntPointer, isTrigger, friction, bounciness);
        }
コード例 #6
0
        public static void UpdateCube(PShape3D shape, PFixture3D fixture, Fix64 x, Fix64 y, Fix64 z, Fix64Vec3 center, Fix64Quat rotation)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateCube(shape.IntPointer, fixture.IntPointer, x, y, z, center, rotation);
        }
コード例 #7
0
        public static void UpdateBodyVelocity(PBody3D body, Fix64Vec3 linearVelocity, Fix64Vec3 angularVelocity)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateBodyVelocity(body.IntPointer, linearVelocity, angularVelocity);
        }
コード例 #8
0
        public static void UpdateBodyTransformForRollback(PBody3D body, Fix64Vec3 pos, Fix64Quat rot, Fix64Quat rot0)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateBodyTransformForRollback(body.IntPointer, pos, rot, rot0);
        }
コード例 #9
0
        public static void UpdateSphere(PShape3D shape, PFixture3D fixture, Fix64 radius, Fix64Vec3 center)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateSphere(shape.IntPointer, fixture.IntPointer, radius, center);
        }
コード例 #10
0
        public static void ApplyForceToCenter(PBody3D body, Fix64Vec3 force)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.ApplyForceToCenter(body.IntPointer, force);
        }
コード例 #11
0
        public static void ApplyAngularImpulse(PBody3D body, Fix64Vec3 impulse)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.ApplyAngularImpulse(body.IntPointer, impulse);
        }
コード例 #12
0
        public static void UpdateMassData(PBody3D body, Fix64 mass, Fix64Vec3 centerOfMass)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateMassData(body.IntPointer, mass, centerOfMass);
        }
コード例 #13
0
        public static void SetAwakeForRollback(PBody3D body, bool awake, Fix64 sleepTime)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.SetAwakeForRollback(body.IntPointer, awake, sleepTime);
        }
コード例 #14
0
        public static void GetWorldSize(ref Fix64Vec3 lower, ref Fix64Vec3 uppder)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.GetWorldSize(internalWorld.IntPointer, ref lower, ref uppder);
        }
コード例 #15
0
        public static void SetAwake(PBody3D body, bool awake)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.SetAwake(body.IntPointer, awake);
        }
コード例 #16
0
        public static void UpdateMesh(PShape3D shape, PFixture3D fixture, Fix64Vec3 scale)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateMesh(shape.IntPointer, fixture.IntPointer, scale);
        }
コード例 #17
0
        public static bool IsAwake(PBody3D body)
        {
            if (!initialized)
            {
                Initialize();
            }

            return(NativeParallel3D.IsAwake(body.IntPointer));
        }
コード例 #18
0
        public static void UpdateCapsule(PShape3D shape, PFixture3D fixture, Fix64Vec3 v1, Fix64Vec3 v2, Fix64 radius, Fix64Vec3 center, Fix64Quat rotation)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateCapsule(shape.IntPointer, fixture.IntPointer, v1, v2, radius, center, rotation);
        }
コード例 #19
0
        public static void ConvextHull3D1(Vector3[] verts, UInt32 count)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.ConvexHull3D1(verts, count);
        }
コード例 #20
0
        public static void ApplyTorque(PBody3D body, Fix64Vec3 torque)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.ApplyTorque(body.IntPointer, torque);
        }
コード例 #21
0
        public static void UpdateMass(PBody3D body, Fix64 mass)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.UpdateMass(body.IntPointer, mass);
        }
コード例 #22
0
        public static void AddExternalConvexCache(PInternalState3D state)
        {
            for (int i = 0; i < state.contactCount; i++)
            {
                PContactExport3D     export       = state.contactExports[i];
                PConvexCacheExport3D convexExport = state.convexExports[i];

                NativeParallel3D.AddExternalConvexCacheData(export.id, convexExport);
            }
        }
コード例 #23
0
        public static PShape3D CreateSphere(Fix64 radius, Fix64Vec3 center)
        {
            if (!initialized)
            {
                Initialize();
            }

            IntPtr m_NativeObject = NativeParallel3D.CreateSphere(radius, center);

            return(new PShape3D(m_NativeObject));
        }
コード例 #24
0
        //3D fixture
        public static PFixture3D AddFixture(PBody3D body, PShape3D shape, Fix64 density)
        {
            if (!initialized)
            {
                Initialize();
            }

            IntPtr m_NativeObject = NativeParallel3D.AddFixtureToBody(body.IntPointer, shape.IntPointer, density);

            return(new PFixture3D(m_NativeObject));
        }
コード例 #25
0
        public static PShape3D CreateCapsule(Fix64Vec3 v1, Fix64Vec3 v2, Fix64 radius, Fix64Vec3 center, Fix64Quat rotation)
        {
            if (!initialized)
            {
                Initialize();
            }

            IntPtr m_NativeObject = NativeParallel3D.CreateCapsule(v1, v2, radius, center, rotation);

            return(new PShape3D(m_NativeObject));
        }
コード例 #26
0
        public static PShape3D CreatePolyhedron(ParallelQHullData parallelQHullData, Fix64Vec3 scale, Fix64Vec3 center, Fix64Quat rotation)
        {
            if (!initialized)
            {
                Initialize();
            }

            IntPtr m_NativeObject = NativeParallel3D.CreateConvex(parallelQHullData.vertices, parallelQHullData.vertexCount, parallelQHullData.edges, parallelQHullData.edgeCount, parallelQHullData.faces, parallelQHullData.faceCount, parallelQHullData.planes, scale, center, rotation);

            return(new PShape3D(m_NativeObject));
        }
コード例 #27
0
        public static PShape3D CreateMesh(ParallelMeshData parallelMeshData, Fix64Vec3 scale)
        {
            if (!initialized)
            {
                Initialize();
            }

            IntPtr m_NativeObject = NativeParallel3D.CreateMesh(parallelMeshData.vertices, parallelMeshData.vertexCount, parallelMeshData.triangles, parallelMeshData.triangleCount, scale);

            return(new PShape3D(m_NativeObject));
        }
コード例 #28
0
        //3D shapes
        public static PShape3D CreateCube(Fix64 x, Fix64 y, Fix64 z, Fix64Vec3 center, Fix64Quat rotation)
        {
            if (!initialized)
            {
                Initialize();
            }

            IntPtr m_NativeObject = NativeParallel3D.CreateCube(x, y, z, center, rotation);

            return(new PShape3D(m_NativeObject));
        }
コード例 #29
0
        public static void ReadNativeBody(PBody3D body)
        {
            if (!initialized)
            {
                Initialize();
            }

            NativeParallel3D.GetTransform(body.IntPointer, ref body.position, ref body.orientation, ref body.orientation0);
            NativeParallel3D.GetVelocity(body.IntPointer, ref body.linearVelocity, ref body.angularVelocity);
            body.awake = NativeParallel3D.IsAwake(body.IntPointer);
            NativeParallel3D.GetSleepTime(body.IntPointer, ref body.sleepTime);
        }
コード例 #30
0
        public static Fix64Vec3 GetPointVelocity(PBody3D body, Fix64Vec3 point)
        {
            if (!initialized)
            {
                Initialize();
            }

            Fix64Vec3 result = Fix64Vec3.zero;

            NativeParallel3D.GetPointVelocity(body.IntPointer, point, ref result);

            return(result);
        }