Skip to content

Commit 0e1f6aa

Browse files
author
mdcutone
committed
RF: Made LibOVRPoseState initialize with no pose.
1 parent 59421bb commit 0e1f6aa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

psychxr/libovr/_libovr.pyx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,10 +1830,11 @@ cdef class LibOVRPoseState(object):
18301830
18311831
Parameters
18321832
----------
1833-
pose : LibOVRPose, list or tuple
1833+
pose : LibOVRPose, list, tuple or None
18341834
Rigid body pose this state refers to. Can be a `LibOVRPose` pose
18351835
instance or a tuple/list of a position coordinate (x, y, z) and
1836-
orientation quaternion (x, y, z, w).
1836+
orientation quaternion (x, y, z, w). If ``None`` the pose will be
1837+
initialized as an identity pose.
18371838
linearVelocity : tuple, list, or ndarray of float
18381839
Linear acceleration vector [vx, vy, vz] in meters/sec.
18391840
angularVelocity : tuple, list, or ndarray of float
@@ -1858,7 +1859,7 @@ cdef class LibOVRPoseState(object):
18581859
cdef np.ndarray _angularAcceleration
18591860

18601861
def __init__(self,
1861-
object pose,
1862+
object pose=None,
18621863
object linearVelocity=(0., 0., 0.),
18631864
object angularVelocity=(0., 0., 0.),
18641865
object linearAcceleration=(0., 0. ,0.),
@@ -1940,7 +1941,10 @@ cdef class LibOVRPoseState(object):
19401941
&self.c_data.AngularAcceleration)
19411942

19421943
# set values
1943-
if isinstance(pose, LibOVRPose):
1944+
if pose is None:
1945+
_ptr.ThePose.Position = [0., 0., 0.]
1946+
_ptr.ThePose.Orientation = [0., 0., 0., 1.]
1947+
elif isinstance(pose, LibOVRPose):
19441948
_ptr.ThePose.Position = (<LibOVRPose>pose).c_data.Position
19451949
_ptr.ThePose.Orientation = (<LibOVRPose>pose).c_data.Orientation
19461950
elif isinstance(pose, (tuple, list,)):

0 commit comments

Comments
 (0)