本文整理汇总了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 )