var shark = new Physijs.ConvexMesh(
new THREE.CylinderGeometry(0.1, 2, 3),
new THREE.MeshPhongMaterial({emissive: 0x999999})
);
shark.receiveShadow = true;
shark.position.copy(pos);
shark.rotation.x = Math.PI/2;
shark.rotation.z = Math.PI/8;
shark.position.z = pos.z + 12;
shark.position.y = pos.y - 15;
ground.add(shark);
}
function addRaft(scene) {
var mesh = new Physijs.ConvexMesh(
new THREE.TorusGeometry(2, 0.5, 8, 20),
Physijs.createMaterial(
new THREE.MeshPhongMaterial({
emissive: 0xcc2222,
specular: 0xeeeeee
}),
0.1,
0.01
)
);
mesh.rotation.x = -Math.PI/2;
mesh.castShadow = true;
scene.add(mesh);
mesh.setAngularFactor(new THREE.Vector3(0, 0, 0));
var rudder = new THREE.Mesh(
new THREE.SphereGeometry(0.5),
new THREE.MeshBasicMaterial({color: 0x000099})
);
rudder.position.set(3, 0, 0);
mesh.add(rudder);
return mesh;
}
//raft.setLinearVelocity(
// new THREE.Vector3(50, 0, -10)
//);
function startGame(raft, river, scoreboard) {
var start = river.river_points[100];
raft.__dirtyPosition = true;
raft.position.set(start.y, start.z + 100, 0);
raft.setLinearVelocity(new THREE.Vector3());
report erratum • discuss
Code: River Rafting • 269
Prepared exclusively for Michael Powell