Skip to content

Commit 606929b

Browse files
committed
Update types-of-constraints.html
1 parent 65c419d commit 606929b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/examples/types-of-constraints.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -152,10 +152,14 @@
152152
}
153153

154154
update() {
155-
this.box.rotation.x += 0.01
156-
this.box.body.needUpdate = true
157-
this.box2.rotation.x += 0.01
158-
this.box2.body.needUpdate = true
155+
if (this.box) {
156+
this.box.rotation.x += 0.01
157+
this.box.body.needUpdate = true
158+
}
159+
if (this.box2) {
160+
this.box2.rotation.x += 0.01
161+
this.box2.body.needUpdate = true
162+
}
159163
}
160164
}
161165
PhysicsLoader('/lib/ammo/kripken', () => new Project({ scenes: [MainScene] }))

0 commit comments

Comments
 (0)