Build a Raft for Racing
A donut shape will work very nicely as a river raft. Add the addRaft call to the code outline at the top of our code.
â | âvarâ ground = addGround(); |
â | âvarâ water = addWater(); |
â | âvarâ scoreboard = addScoreboard(); |
» | âvarâ raft = addRaft(); |
Again, this breaks things because thereâs no addRiver() function yet. Letâs add it after the last curly brace in the addScoreboard() function.
â | âfunctionâ addRaft() { |
â | âvarâ shape = ânewâ THREE.TorusGeometry(0.1, 0.05, 8, 20); |
â | âvarâ _cover = ânewâ THREE.MeshPhongMaterial({visible: âfalseâ}); |
â | âvarâ cover = Physijs.createMaterial(_cover, 0.4, 0.6); |
â | âvarâ mesh = ânewâ Physijs.ConvexMesh(shape, cover, 0.25); ... |
Get 3D Game Programming for Kids, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.