Closed sdbugs closed 9 years ago
lookAt()
does set the center.
The camera does not have a position, except implicitly, as a result of the composition of rotation, center, and distance.
void SetCamVector(float x, float y, float z) { Rotation rot=new Rotation(new Vector3D(0,0,10),new Vector3D(x,y,z)); camera.setState(new CameraState(rot, new Vector3D(0,0,0), camera.getDistance())); }
A setPosition()
would be very handy, as I find working with explicit position a lot more intuitive! Would a PR be of interest?
No; thank you, but I really think something like the OCD library, or just manual camera control, would be better.
I really like how PeasyCam works - especially with the double-clicking returning you to the default position. The only thing I'm missing is setting this default position of PeasyCam programmatically. So far, on this issue I've found:
How to change PeasyCam position - Processing Forum
3d - Rotating camera around object axis with Peasycam - Stack Overflow
However, looking at the code, I notice
peasycam/src/peasy/CameraState.java
has:I'm not sure if the
center
refers to the camera position (cannot tell, because printing it fails the compilation with "The field CameraState.center is not visible
"; and I couldn't really test with a new class, because of Is javac supposed to be included with Processing 2* or not? · Issue #2929 · processing/processing · GitHub), but if it does, then all that is needed is to make these properties public instead of final; then I could in principle do (pseudocode):... and then, if something like
cam.setDefaultPosition()
is added to the API, I could "memorize" the new position (and rotation, as per thelookAt()
) as the default, to which the PeasyCam would return upon doubleclick.However, I'm primarily interested in setting the position programatically - I can somewhat do it with
.pan(x,y)
(in the x/y plane normal to the camera at start, I guess); but if I dolookAt()
after it, the position seemingly gets reset. Is there a way I can do it with the current API? If not, what are the chances for changes to the current API, so that something like the above pseudocode becomes possible?