Ejemplo n.º 1
0
	def position(self, node):
		pos = node.getPos(render)
		quat = node.getQuat(render)
		
		"""
		Get the item tag
		"""
		item = node.getTag("item")
		
		if item == "box":
			asset = "bla"#pickableBox()
		elif item == "ball":
			asset = "bla" #pickableBall()
		elif item == "grenade":
			asset = grenade()
		elif item == "door":
			asset = door()
			asset.state = "close"
			
		elif item == "gun":
			asset = gun()
		elif item == "rifle":
			asset = assaultRifle()
		elif item == "shotgun":
			asset = "bla"#shotgun()
			
		elif item == "movingPlatform":
			"""
			This platform is just for presentation, you can load it however you want
			since, as you'll find in the assets/movingPlatform.py, it's just a kinematic
			object animated with a Sequence.
			"""
			asset = movingPlatform()
		
		if asset != "bla":
			
		
			"""
			I have separated creating an item from actually putting it into the world.
			I find it more convenient to do it this way.
			"""
			print "Creating:", item
			asset.setupGeomAndPhysics(self, pos, quat)
			asset.showCCD = self.defaultShowCCD
		
		"""
		Add the object to a currect category based on yet another tag.
		This could also be done with a variable inside the actuall
		object class.
		"""
		if node.getTag("category") == "dynamic":
			self.mapObjects["dynamics"].append(asset)
		elif node.getTag("category") == "kinematic":
			self.mapObjects["kinematics"].append(asset)
		
		return asset
Ejemplo n.º 2
0
 def position(self, node):
     pos = node.getPos(render)
     quat = node.getQuat(render)
     
     """
     Get the item tag
     """
     item = node.getTag("item")
     
     if item == "box":
         asset = pickableBox()
     elif item == "ball":
         asset = pickableBall()
     elif item == "grenade":
         asset = grenade()
     elif item == "door":
         asset = door()
         asset.state = "close"
         
     elif item == "gun":
         asset = gun()
     elif item == "rifle":
         asset = assaultRifle()
     elif item == "shotgun":
         asset = shotgun()
     
     """
     I have separated creating an item from actually putting it into the world.
     I find it more convenient to do it this way.
     """
     print "Creating:", item
     asset.setupGeomAndPhysics(self, pos, quat)
     asset.showCCD = self.defaultShowCCD
     
     """
     Add the object to a currect category based on yet another tag.
     This could also be done with a variable inside the actuall
     object class.
     """
     if node.getTag("category") == "dynamic":
         self.mapObjects["dynamics"].append(asset)
     elif node.getTag("category") == "kinematic":
         self.mapObjects["kinematics"].append(asset)
     
     return asset
Ejemplo n.º 3
0
    def position(self, node):
        pos = node.getPos(render)
        quat = node.getQuat(render)
        """
        Get the item tag
        """
        item = node.getTag("item")

        if item == "box":
            asset = pickableBox()
        elif item == "ball":
            asset = pickableBall()
        elif item == "grenade":
            asset = grenade()
        elif item == "door":
            asset = door()
            asset.state = "close"

        elif item == "gun":
            asset = gun()
        elif item == "rifle":
            asset = assaultRifle()
        elif item == "shotgun":
            asset = shotgun()
        """
        I have separated creating an item from actually putting it into the world.
        I find it more convenient to do it this way.
        """
        print "Creating:", item
        asset.setupGeomAndPhysics(self, pos, quat)
        asset.showCCD = self.defaultShowCCD
        """
        Add the object to a currect category based on yet another tag.
        This could also be done with a variable inside the actuall
        object class.
        """
        if node.getTag("category") == "dynamic":
            self.mapObjects["dynamics"].append(asset)
        elif node.getTag("category") == "kinematic":
            self.mapObjects["kinematics"].append(asset)

        return asset