Jyun-Ming Chen
Jyun-Ming Chen

Reputation: 23

Moving Orthographic Camera to following a line

I want to plot a series of polling data along a time line, namely (ti, f(ti), 0). To get a better view, I also modify the (ortho) camera x-position to follow the data line.

The stationary referencing grid showed up just fine ("moving to the left" as time progresses). But the line disappears as soon as it goes over the "right" bound of the orthographic camera.

I tried to comment out the camera moving code (camera.position.x += 5) (... so that the camera does not move) and the line showed up all the way until it moves out of bound. ... but this is not what I want.

(best explained in this jsfiddle: http://jsfiddle.net/jmcjc5u/4wfhb1da/)

xx += 0.1;
pt = new THREE.Vector3(xx, 5 * Math.sin(xx), 0);
addPoint(pt);

if (xx - camera.position.x > 5) {
   camera.position.x += 5
}

Upvotes: 0

Views: 112

Answers (1)

corashina
corashina

Reputation: 1887

Simple solution would be to always render the line

jsfiddle

myLine.frustumCulled = false;

Upvotes: 1

Related Questions