public override CollisionProxy CreateSphereCollision(ISphereShape shape, int layer = 1, int mask = -1)
        {
            CollisionObject co = new CollisionObject();

            co.CollisionShape = new SphereShape(shape.Radius);
            world.AddCollisionObject(co, (short)layer, (short)mask);
            return(new BulletCollision(co, null));
        }
예제 #2
0
        void ILeafVisitorOf <ISphereShape> .Visit(ISphereShape sphereShape)
        {
            IModel model;

            if (!_allocatedModels.TryGetValue(sphereShape, out model))
            {
                model = _allocatedModels[sphereShape] = Models.Sphere.Scaled(sphereShape.Radius, sphereShape.Radius, sphereShape.Radius);
            }
            DrawShape(sphereShape, model);
        }
예제 #3
0
    public AutoMesh SpawnMesh(ISphereShape shape, int subdivisions = 4)
    {
        // clamp division in [1, 6]
        subdivisions = Mathf.Clamp(subdivisions, 1, 6);
        GameObject go   = new GameObject();
        SphereMesh mesh = go.AddComponent <SphereMesh>();

        mesh.material     = defaultMaterial;
        mesh.subdivisions = subdivisions;
        mesh.SetRadius(shape.Radius);
        return(mesh);
    }
예제 #4
0
 public void CopyStateTo(ISphereShape element)
 {
     element.Descriptor = Descriptor;
 }
예제 #5
0
 public void CopyStateTo(ISphereShape element)
 {
     element.Descriptor = Descriptor;
 }
 /// <summary>
 /// Create standard sphere collision
 /// </summary>
 /// <param name="shape">sphere shape interface</param>
 /// <param name="layer">layer of collision</param>
 /// <param name="mask">mask of collision</param>
 public abstract CollisionProxy CreateSphereCollision(ISphereShape shape, int layer = 1, int mask = -1);