Pārlūkot izejas kodu

Few extra camera position setters

Added methods to set the camera position for individual axes.
MrWaggel 8 gadi atpakaļ
vecāks
revīzija
3e2a56a074
1 mainītis faili ar 27 papildinājumiem un 0 dzēšanām
  1. 27 0
      camera/camera.go

+ 27 - 0
camera/camera.go

@@ -90,6 +90,33 @@ func (cam *Camera) SetPosition(x, y, z float32) {
 	cam.updateQuaternion()
 }
 
+// SetPositionX sets this camera world position
+// This method overrides the Node method to update
+// the camera quaternion, because changing the camera position
+// may change its rotation
+func (cam *Camera) SetPositionX(x float32) {
+	cam.Node.SetPositionX(x)
+	cam.updateQuaternion()
+}
+
+// SetPositionY sets this camera world position
+// This method overrides the Node method to update
+// the camera quaternion, because changing the camera position
+// may change its rotation
+func (cam *Camera) SetPositionY(y float32) {
+	cam.Node.SetPositionY(y)
+	cam.updateQuaternion()
+}
+
+// SetPositionZ sets this camera world position
+// This method overrides the Node method to update
+// the camera quaternion, because changing the camera position
+// may change its rotation
+func (cam *Camera) SetPositionZ(z float32) {
+	cam.Node.SetPositionZ(z)
+	cam.updateQuaternion()
+}
+
 // SetPositionVec sets this node position from the specified vector pointer
 // This method overrides the Node method to update
 // the camera quaternion, because changing the camera position