当前位置: 首页>>代码示例>>Python>>正文


Python PyUtils.angleAxisToQuaternion方法代码示例

本文整理汇总了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)
开发者ID:MontyThibault,项目名称:cartwheel-3d-Research-Modifications,代码行数:36,代码来源:Staircase.py

示例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 )
开发者ID:MontyThibault,项目名称:cartwheel-3d-Research-Modifications,代码行数:6,代码来源:Member.py


注:本文中的PyUtils.angleAxisToQuaternion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。