mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-02-01 16:08:17 +00:00
各种类型几何体添加物理数据。
This commit is contained in:
parent
eab22a8e6b
commit
96709ccd10
@ -9,6 +9,17 @@ function Circle(geometry = new THREE.CircleBufferGeometry(1, 32), material = new
|
||||
this.name = '圆';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btBoxShape',
|
||||
mass: 1,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Circle.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -9,6 +9,17 @@ function Cylinder(geometry = new THREE.CylinderBufferGeometry(1, 1, 2, 32, 1, fa
|
||||
this.name = '圆柱体';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btBoxShape',
|
||||
mass: 1,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Cylinder.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -9,6 +9,17 @@ function Icosahedron(geometry = new THREE.IcosahedronBufferGeometry(1, 2), mater
|
||||
this.name = '二十面体';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btBoxShape',
|
||||
mass: 1,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Icosahedron.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -23,6 +23,17 @@ function Lathe(geometry = new THREE.LatheBufferGeometry(points, 20, 0, 2 * Math.
|
||||
this.name = '酒杯';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btBoxShape',
|
||||
mass: 1,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Lathe.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -10,6 +10,17 @@ function Plane(geometry = new THREE.PlaneBufferGeometry(50, 50), material = new
|
||||
this.rotation.x = -Math.PI / 2;
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btStaticPlaneShape',
|
||||
mass: 0,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Plane.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -9,6 +9,17 @@ function Sphere(geometry = new THREE.SphereBufferGeometry(1, 32, 16, 0, Math.PI
|
||||
this.name = '球体';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btSphereShape',
|
||||
mass: 0,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Sphere.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -23,6 +23,17 @@ function Teapot(geometry = new THREE.TeapotBufferGeometry(3, 10, true, true, tru
|
||||
this.name = '茶壶';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btBoxShape',
|
||||
mass: 1,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Teapot.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -9,6 +9,17 @@ function Torus(geometry = new THREE.TorusBufferGeometry(2, 1, 32, 32, Math.PI *
|
||||
this.name = '轮胎';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btBoxShape',
|
||||
mass: 1,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Torus.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
@ -9,6 +9,17 @@ function TorusKnot(geometry = new THREE.TorusKnotBufferGeometry(2, 0.8, 64, 12,
|
||||
this.name = '纽结';
|
||||
this.castShadow = true;
|
||||
this.receiveShadow = true;
|
||||
|
||||
this.userData.physics = this.userData.physics || {
|
||||
enabled: false,
|
||||
shape: 'btBoxShape',
|
||||
mass: 1,
|
||||
inertia: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
TorusKnot.prototype = Object.create(THREE.Mesh.prototype);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user