Пример #1
0
	def placeDebug(self, pos, color):
		if str(self.geom.getClassType()) == "OdeBoxGeom":
			np = wireGeom().generate("box", extents = list(self.geom.getLengths() * 0.5))
		elif str(self.geom.getClassType()) == "OdeSphereGeom":
			np = wireGeom().generate("sphere", radius = self.geom.getRadius())
		
		np.reparentTo(render)
		
		np.setPos(render, pos)
		np.setQuat(render, self.geom.getQuaternion())
		
		np.setColor(color)
Пример #2
0
	def setCapsuleGeom(self, radius, length):
		self.geom = OdeCappedCylinderGeom(self.map.worldManager.getSpace(), radius, length)
		
		if self.visualize:
			self.visualization = wireGeom().generate("capsule", radius = radius, length = length)
			self.visualization.reparentTo(render)
			if self.nodePath:
				self.visualization.setPos(self.nodePath.getPos(render))
			
		self.synchPosQuatToNode()
Пример #3
0
	def setSphereGeom(self, radius):
		self.geom = OdeSphereGeom(self.map.worldManager.getSpace(), radius)
		
		if self.visualize:
			self.visualization = wireGeom().generate("sphere", radius = radius)
			self.visualization.reparentTo(render)
			if self.nodePath:
				self.visualization.setPos(self.nodePath.getPos(render))
		
		self.synchPosQuatToNode()
Пример #4
0
	def setBoxGeom(self, size):
		self.boxSize = size
		self.geom = OdeBoxGeom(self.map.worldManager.getSpace(), size)
		
		"""
		If visualization is enabled, create the visualization node.
		Note that the visualization technique has changed. Now I use the fantastic code
		by FenrirWolf. If you read this -- big thanks, it's awesome!
		"""
		if self.visualize:
			self.visualization = wireGeom().generate("box", extents = list(self.geom.getLengths() * 0.5))
			self.visualization.reparentTo(render)
			if self.nodePath:
				self.visualization.setPos(self.nodePath.getPos(render))
			
		"""
		If a nodePath is set, get the position and rotation from it
		"""
		self.synchPosQuatToNode()