def setup
createCanvas(100, 100, WEBGL)
normalMaterial
@cam = createCamera
end
def draw
background(200)
# look at a new random point every 60 frames
if frameCount % 60 == 0
@cam.lookAt(random(-100, 100), random(-50, 50), 0)
end
rotateX(frameCount * 0.01)
translate(-100, 0, 0)
box(20)
6.times do
translate(35, 0, 0)
box(20)
end
end
[p5.js] (p5.Camera.obj).lookAt
カメラの視界の中心位置を設定します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| x | カメラの視界の中心位置の x座標 | |||
| y | カメラの視界の中心位置の y座標 | |||
| z | カメラの視界の中心位置の z座標 |
なし