fba
March 5, 2023, 9:02pm
1
I just noticed that in the setFrame() methods of the Camera class (lines 912 and 968) we have this:
this.location = location;
instead of this:
this.location.set(location);
Is that a bug or a feature? Can I trust this behavior to set the camera’s location to a new Vector3f?
* @param location the point position of the camera.
* @param left the left axis of the camera.
* @param up the up axis of the camera.
* @param direction the facing of the camera.
* @see Camera#setFrame(com.jme3.math.Vector3f,
* com.jme3.math.Vector3f, com.jme3.math.Vector3f, com.jme3.math.Vector3f)
*/
public void setFrame(Vector3f location, Vector3f left, Vector3f up,
Vector3f direction) {
this.location = location;
this.rotation.fromAxes(left, up, direction);
onFrameChange();
}
/**
* A convenience method for auto-setting the frame
* based on a world position the user desires the camera to look at. It
* repoints the camera towards the given position using the difference
* between the position and the current camera location as a direction
* vector and the worldUpVector to compute up and left camera vectors.
1 Like
pspeed
March 5, 2023, 9:21pm
2
My guess is that it’s an oversight on someone’s part… ie: a bug.
Unfortunately, it’s also the kind of thing that someone might be incorrectly relying on so it would be a potentially “breaking change” to fix it in a point-release.
I wouldn’t rely on the sharing. None of the other parameters are shared and I believe I’d be 100% surprised if I’d discovered the sharing by accident.
So I vote: it’s a bug.
4 Likes