public void UpdateCamera() { if (RenderCamera == null || Viewport.Camera == null) { return; } Transform camTrans = RenderCamera.transform; Vector3 camPos = camTrans.position; Vector3 camForward = camTrans.forward; // Negate the x position and direction as Unity is left handed while RS is right handed. Vector3D pos = new Vector3D(-camPos.x, camPos.y, camPos.z); Vector3D forward = new Vector3D(-camForward.x, camForward.y, camForward.z); Vector3D up = new Vector3D(0, 1, 0); Transform3D trans = new Transform3D(); trans.SetLookAt(pos, forward, up); Viewport.Camera.TransformMatrix = trans.world_to_object; }
public Transform3D Clone() { Transform3D c = new Transform3D(); c.world_to_object = world_to_object.Clone(); c.coord_system = coord_system; c.ref_dir = ref_dir.clone(); c.ref_up = ref_up.clone(); c.ref_right = ref_right.clone(); c.location = location.clone(); c.direction = direction.clone(); c.up = up.clone(); c.target = target.clone(); //TODO: Derive Vectors return c; }