Creating interactive 3D graphics using package RGL in TERR

I'm using the rgl package to create an interactive 3D plot. This works great in R, but seems to have an issue in TERR. While the plot appears to be rendered correctly, it does not accept user interaction and closes itself as soon as the TERR script has finished executing.

Sample code:


x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x, y)
plot3d(x, y, z, col = rainbow(1000))


Does anyone know how to fix this so user interaction is possible and the window does not close when the script executes?

(2) Answers