コード例 #1
0
 public static CCollisionConvexPrimitives[] GetNewtonCollisions(ICollection<ConvexCollisionMask> collisions)
 {
     int i = 0;
     CCollisionConvexPrimitives[] handles = new CCollisionConvexPrimitives[collisions.Count];
     foreach (ConvexCollisionMask c in collisions)
     {
         handles[i++] = c.NewtonCollision;
     }
     return handles;
 }
コード例 #2
0
        public CCollisionConvexPrimitives CreateConvexHullModifier()
        {
            CheckHandle();
            MakeUnique();
            CCollisionConvexPrimitives modifier = new CCollisionConvexPrimitives(m_World);

            modifier.m_Handle = Newton.NewtonCreateConvexHullModifier(m_World.Handle, m_Handle);

            CHashTables.Collision.Add(modifier.m_Handle, modifier);

            return(modifier);
        }
コード例 #3
0
        protected override CCollision OnInitialise()
        {
            base.OnInitialise();

            if (!(this.Geometry is MeshGeometry3D))
                throw new InvalidOperationException("Only MeshGeometry3D supported.");

            _points = GeometryHelper.GetGeometryPoints((MeshGeometry3D)this.Geometry, Matrix3D.Identity);
            if (_points == null)
                throw new InvalidOperationException("The MeshGeometry3D contains no geometry.");

            CCollisionConvexPrimitives collision = new CCollisionConvexPrimitives(this.World.NewtonWorld);
            collision.CreateConvexHull(_points, Matrix3D.Identity);

            return collision;
        }
コード例 #4
0
        public CCollisionConvexPrimitives CreateConvexHullModifier()
        {
            CheckHandle();
            MakeUnique();
            CCollisionConvexPrimitives modifier = new CCollisionConvexPrimitives(m_World);
            modifier.m_Handle = Newton.NewtonCreateConvexHullModifier(m_World.Handle, m_Handle);

            CHashTables.Collision.Add(modifier.m_Handle, modifier);

            return modifier;
        }
コード例 #5
0
 protected override CCollision OnInitialise()
 {
     CCollisionConvexPrimitives collision = new CCollisionConvexPrimitives(this.World.NewtonWorld);
     collision.CreateNull();
     return collision;
 }