Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit c597eea

Browse files
committed
moved hit detection to mousePressed()
1 parent a67406a commit c597eea

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ar/ex1_ar_intro/ex1_ar_intro.pde

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ void setup() {
1616

1717
void draw() {
1818
lights();
19-
20-
if (mousePressed) {
21-
if (touchAnchor != null) touchAnchor.dispose();
22-
ARTrackable hit = tracker.get(mouseX, mouseY);
23-
if (hit != null) touchAnchor = new ARAnchor(hit);
24-
else touchAnchor = null;
25-
}
2619

2720
drawObject(touchAnchor);
2821
for (ARAnchor anchor : trackAnchors) {
@@ -34,6 +27,13 @@ void draw() {
3427
drawTrackables();
3528
}
3629

30+
void mousePressed() {
31+
if (touchAnchor != null) touchAnchor.dispose();
32+
ARTrackable hit = tracker.get(mouseX, mouseY);
33+
if (hit != null) touchAnchor = new ARAnchor(hit);
34+
else touchAnchor = null;
35+
}
36+
3737
void trackableEvent(ARTrackable t) {
3838
if (trackAnchors.size() < 10 && t.isFloorPlane()) {
3939
trackAnchors.add(new ARAnchor(t, 0, 0, 0));

0 commit comments

Comments
 (0)