本文整理匯總了Python中pandac.PandaModules.SmoothMover.setHpr方法的典型用法代碼示例。如果您正苦於以下問題:Python SmoothMover.setHpr方法的具體用法?Python SmoothMover.setHpr怎麽用?Python SmoothMover.setHpr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandac.PandaModules.SmoothMover
的用法示例。
在下文中一共展示了SmoothMover.setHpr方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: DistributedBanquetTable
# 需要導入模塊: from pandac.PandaModules import SmoothMover [as 別名]
# 或者: from pandac.PandaModules.SmoothMover import setHpr [as 別名]
#.........這裏部分代碼省略.........
self.changeDinerToHungry(chairIndex)
elif status == self.ANGRY:
self.changeDinerToAngry(chairIndex)
elif status == self.DEAD:
self.changeDinerToDead(chairIndex)
elif status == self.HIDDEN:
self.changeDinerToHidden(chairIndex)
def removeFoodModel(self, chairIndex):
serviceLoc = self.serviceLocs.get(chairIndex)
if serviceLoc:
for i in xrange(serviceLoc.getNumChildren()):
serviceLoc.getChild(0).removeNode()
def changeDinerToEating(self, chairIndex):
indicator = self.dinerStatusIndicators.get(chairIndex)
eatingDuration = self.dinerInfo[chairIndex][1]
if indicator:
indicator.request("Eating", eatingDuration)
diner = self.diners[chairIndex]
intervalName = "eating-%d-%d" % (self.index, chairIndex)
eatInTime = 32.0 / 24.0
eatOutTime = 21.0 / 24.0
eatLoopTime = 19 / 24.0
rightHand = diner.getRightHand()
waitTime = 5
loopDuration = eatingDuration - eatInTime - eatOutTime - waitTime
serviceLoc = self.serviceLocs[chairIndex]
def foodAttach(self=self, diner=diner):
foodModel = self.serviceLocs[chairIndex].getChild(0)
(foodModel.reparentTo(diner.getRightHand()),)
(foodModel.setHpr(Point3(0, -94, 0)),)
(foodModel.setPos(Point3(-0.14999999999999999, -0.69999999999999996, -0.40000000000000002)),)
scaleAdj = 1
if SuitDNA.getSuitBodyType(diner.dna.name) == "c":
scaleAdj = 0.59999999999999998
(foodModel.setPos(Point3(0.10000000000000001, -0.25, -0.31)),)
else:
scaleAdj = 0.80000000000000004
(foodModel.setPos(Point3(-0.25, -0.84999999999999998, -0.34000000000000002)),)
oldScale = foodModel.getScale()
newScale = oldScale * scaleAdj
foodModel.setScale(newScale)
def foodDetach(self=self, diner=diner):
foodModel = diner.getRightHand().getChild(0)
(foodModel.reparentTo(serviceLoc),)
(foodModel.setPosHpr(0, 0, 0, 0, 0, 0),)
scaleAdj = 1
if SuitDNA.getSuitBodyType(diner.dna.name) == "c":
scaleAdj = 0.59999999999999998
else:
scakeAdj = 0.80000000000000004
oldScale = foodModel.getScale()
newScale = oldScale / scaleAdj
foodModel.setScale(newScale)
eatIval = Sequence(
ActorInterval(diner, "sit", duration=waitTime),
ActorInterval(diner, "sit-eat-in", startFrame=0, endFrame=6),
Func(foodAttach),
ActorInterval(diner, "sit-eat-in", startFrame=6, endFrame=32),
ActorInterval(diner, "sit-eat-loop", duration=loopDuration, loop=1),
ActorInterval(diner, "sit-eat-out", startFrame=0, endFrame=12),
示例2: ProgressiveLoader
# 需要導入模塊: from pandac.PandaModules import SmoothMover [as 別名]
# 或者: from pandac.PandaModules.SmoothMover import setHpr [as 別名]
#.........這裏部分代碼省略.........
self.duration = self.capturedata['duration']
self.positions = self.capturedata['positions']
self.rotations = self.capturedata['rotations']
self.curve_creator = motioncap.CreateNurbsCurve()
for pos, rot in zip(self.positions, self.rotations):
self.curve_creator.addPoint(pos, rot)
self.mopath = self.curve_creator.getMotionPath()
self.interval = MopathInterval.MopathInterval(self.mopath, self.cam, duration=self.duration, name="Camera Replay")
else:
controls.KeyboardMovement()
controls.MouseCamera()
self.update_camera_predictor_task = self.taskMgr.doMethodLater(0.1, self.update_camera_predictor, 'update_camera_predictor')
self.update_priority_task = self.taskMgr.doMethodLater(0.5, self.check_pool, 'check_pool')
self.load_waiting_task = self.taskMgr.doMethodLater(0.1, self.load_waiting, 'load_waiting')
def run(self):
if self.screenshot_dir is not None:
self.start_time = None
self.screenshot_info = []
self.screenshot_task = self.taskMgr.doMethodLater(0, self.trigger_screenshot, 'screenshot_task', sort=-1)
if self.capturefile is not None:
self.interval.start()
self.taskMgr.doMethodLater(self.duration + 2.0, self.finished, 'exiter')
ShowBase.ShowBase.run(self)
def update_camera_predictor(self, task):
curtime = self.globalClock.getFrameTime()
self.smooth_mover.setPos(self.cam.getPos())
self.smooth_mover.setHpr(self.cam.getHpr())
self.smooth_mover.setTimestamp(curtime)
self.smooth_mover.markPosition()
return task.again
def check_pool(self, task):
t0 = time.time()
finished_tasks = self.multiplexer.poll(self.pandastate)
t1 = time.time()
time_took = t1-t0
time_wait = time_took * 2.0
time_wait = min(time_wait, 1)
time_wait = max(time_wait, 0.1)
task.delayTime = time_wait
if len(finished_tasks) == 0 and self.multiplexer.empty():
print
print 'FINISHED LOADING'
print
return task.done
for t in finished_tasks:
if isinstance(t, meshtask.MeshLoadTask):
self.loader.loadModel(t.bam_file, callback=self.model_loaded, extraArgs=[t.modelslug], priority=self.loading_priority)
elif isinstance(t, texturetask.TextureDownloadTask):
self.loader.loadModel(t.bam_file, callback=self.texture_loaded, extraArgs=[t.modelslug], priority=self.loading_priority)
elif isinstance(t, refinementtask.MeshRefinementDownloadTask):
if t.modelslug in self.models_loaded:
self.waiting.append((LOAD_TYPE.MESH_REFINEMENT, t.modelslug, t.pm_refinements))
else:
self.pm_waiting[t.modelslug].append(t.pm_refinements)
elif isinstance(t, metadata.MetadataDownloadTask):