~vam-jam/vamist.dev

9d9c09a101448502ccac59ec01d7bc4c8ce41c00 — Vamist 3 months ago b06c187
[dev] Dynamic sizes
1 files changed, 5 insertions(+), 2 deletions(-)

M src/blobs/Cube.js
M src/blobs/Cube.js => src/blobs/Cube.js +5 -2
@@ 52,17 52,20 @@ export function BasicCube(position) {

// A simple cube with gravity
export function ThrowingCube(position) {
	let size = 0.05 + Math.random() / 10.0;
	const cube = new Cube(
		position,
		new BoxGeometry(0.1, 0.1, 0.1),
		new BoxGeometry(size, size, size),
		new MeshLambertMaterial({
			color: new Color(0.2, 0.2, 0.2),
		}),
	);

	size = size / 2;

	cube.BuildPhysics(
		RigidBodyDesc.dynamic().setTranslation(position.x, position.y, position.z),
		ColliderDesc.cuboid(0.05, 0.05, 0.05).setMass(1.0),
		ColliderDesc.cuboid(size, size, size).setMass(1.0),
	);

	return cube;