Camera — Aspose.3D FOSS for Java
Package: com.aspose.threed (aspose-3d-foss 26.1.0)
Camera is an Entity that defines a viewpoint in a 3D scene. It controls how the scene is projected onto a 2D image plane. A camera is attached to a Node to position and orient it in the scene.
public class Camera extends EntityInheritance
A3DObject -> SceneObject -> Entity -> Camera
Implementation Notes
In the Java FOSS edition, the Camera class has constructors only — no camera-specific properties (field-of-view, near/far plane, projection mode) are implemented.
Export limitation: Camera entities are not written when exporting scenes. The glTF exporter (
GltfExporter) processes onlyMeshentities — Camera nodes are silently skipped. This means a camera attached to a node will not appear in any exported file. The “Read Camera After Import” example below shows how to read camera names from an imported file; however, writing cameras back to a new file is not supported in this edition.
Constructor
Camera()
Camera(String name)| Parameter | Type | Default | Description |
|---|---|---|---|
name | String | null | Optional name for the camera. |
Properties
Camera inherits all properties from Entity and A3DObject. No additional format-specific properties are exposed in this edition.
| Property | Type | Getter | Setter | Description |
|---|---|---|---|---|
name | String | getName() | setName(String) | Name of the camera object. |
parentNode | Node | getParentNode() | setParentNode(Node) | The node this camera is attached to. |
excluded | boolean | getExcluded() | setExcluded(boolean) | When true, this entity is excluded from export. |
Usage Examples
Attach a Camera to a Scene
import com.aspose.threed.*;
Scene scene = new Scene();
Camera cam = new Camera("MainCamera");
Node node = scene.getRootNode().createChildNode("camera", cam);
node.getTransform().setTranslation(0.0, 5.0, 20.0);
scene.save("scene-with-camera.glb");Read Camera After Import
import com.aspose.threed.*;
Scene scene = new Scene();
scene.open("model.glb");
for (Node node : scene.getRootNode().getChildNodes()) {
if (node.getEntity() instanceof Camera) {
Camera cam = (Camera) node.getEntity();
System.out.println("Camera: " + cam.getName());
}
}