简体   繁体   中英

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
}

Simple solution would be to always render the line

jsfiddle

myLine.frustumCulled = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM