本文整理匯總了Python中PyUtils.angleAxisToQuaternion方法的典型用法代碼示例。如果您正苦於以下問題:Python PyUtils.angleAxisToQuaternion方法的具體用法?Python PyUtils.angleAxisToQuaternion怎麽用?Python PyUtils.angleAxisToQuaternion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyUtils
的用法示例。
在下文中一共展示了PyUtils.angleAxisToQuaternion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: load
# 需要導入模塊: import PyUtils [as 別名]
# 或者: from PyUtils import angleAxisToQuaternion [as 別名]
def load(self):
assert not self._loaded, "Cannot load scenario twice!"
self._loaded = True
# Create the rigid bodies for the main staircase
orientation = PyUtils.angleAxisToQuaternion( (self._angle,(0,1,0)) )
size = MathLib.Vector3d( self._staircaseWidth, self._riserHeight, self._threadDepth )
pos = PyUtils.toPoint3d( self._position ) + MathLib.Vector3d( 0, -self._riserHeight/2.0, 0 )
delta = MathLib.Vector3d(size)
delta.x = 0
delta = orientation.rotate( delta )
for i in range(self._stepCount):
box = PyUtils.RigidBody.createBox( size, pos = pos + delta * (i+1), locked = True, orientation=orientation )
Physics.world().addRigidBody(box)
# Create the rigid bodies for both ramps
rampHeights = ( self._leftRampHeight, self._rightRampHeight )
deltaRamp = MathLib.Vector3d(self._staircaseWidth/2.0,0,0)
deltaRamp = orientation.rotate( deltaRamp )
deltaRamps = (deltaRamp, deltaRamp * -1)
for deltaRamp, rampHeight in zip( deltaRamps, rampHeights ):
if rampHeight is None: continue
deltaRamp.y = rampHeight/2.0
box = PyUtils.RigidBody.createBox( (0.02,rampHeight,0.02), pos = pos + deltaRamp + delta , locked = True, orientation=orientation )
Physics.world().addRigidBody(box)
box = PyUtils.RigidBody.createBox( (0.02,rampHeight,0.02), pos = pos + deltaRamp + (delta * self._stepCount) , locked = True, orientation=orientation )
Physics.world().addRigidBody(box)
deltaRamp.y = rampHeight
rampOrientation = orientation * PyUtils.angleAxisToQuaternion( (math.atan2(self._riserHeight, self._threadDepth), (-1,0,0)) )
rampLen = self._stepCount * math.sqrt( self._riserHeight*self._riserHeight + self._threadDepth*self._threadDepth )
box = PyUtils.RigidBody.createBox( (0.04,0.02,rampLen), pos = pos + deltaRamp + (delta * ((self._stepCount+1) * 0.5)) , locked = True, orientation=rampOrientation )
Physics.world().addRigidBody(box)
示例2: interpret
# 需要導入模塊: import PyUtils [as 別名]
# 或者: from PyUtils import angleAxisToQuaternion [as 別名]
def interpret(self, value):
value = self.basicInterpret(value)
if isinstance(value, MathLib.Quaternion) : return value
else : return PyUtils.angleAxisToQuaternion( value )