def explode(self): # This is stolen from the Texture-Swapping sample self.expPlane = loader.loadModel('assets/models/plane') #load the object self.expPlane.reparentTo(self.baseNode) #reparent to render self.expPlane.setTransparency(1) #enable transparency self.expPlane.setScale(3) self.expPlane.setBin("fixed", 40) self.expPlane.setDepthTest(False) self.expPlane.setDepthWrite(False) #load the texture movie self.expTexs = self.loadTextureMovie(51, 'assets/textures/explosion/explosion', 'png', padding = 4) #create the animation task self.expTaskCounter = 0 self.expTask = taskMgr.add(self.textureMovie, "explosionTask") self.expTask.fps = 30 #set framerate self.expTask.obj = self.expPlane #set object self.expTask.textures = self.expTexs #set texture list #This create the "billboard" effect that will rotate the object soremove that it #is always rendered as facing the eye (camera) self.expPlane.node().setEffect(BillboardEffect.makePointEye())
def explode(self): # This is stolen from the Texture-Swapping sample self.expPlane = loader.loadModel( 'assets/models/plane') #load the object self.expPlane.reparentTo(self.baseNode) #reparent to render self.expPlane.setTransparency(1) #enable transparency self.expPlane.setScale(3) self.expPlane.setBin("fixed", 40) self.expPlane.setDepthTest(False) self.expPlane.setDepthWrite(False) #load the texture movie self.expTexs = self.loadTextureMovie( 51, 'assets/textures/explosion/explosion', 'png', padding=4) #create the animation task self.expTaskCounter = 0 self.expTask = taskMgr.add(self.textureMovie, "explosionTask") self.expTask.fps = 30 #set framerate self.expTask.obj = self.expPlane #set object self.expTask.textures = self.expTexs #set texture list #This create the "billboard" effect that will rotate the object soremove that it #is always rendered as facing the eye (camera) self.expPlane.node().setEffect(BillboardEffect.makePointEye())
def __init__(self, parent, pos=Vec3(0, 0, 0), size=1, color=Vec4(0, 0, 0, 1)): print(" Creating circle at " + str(pos)) self.aaLevel= 16 self.pos = pos self.size = size self.color = color self._np = self.draw() self._np.setTwoSided(True) self._np.setTransparency(1) self._np.setAttrib(DepthTestAttrib.make(RenderAttrib.MNone)) self._np.setEffect(BillboardEffect.makePointEye()) if self.aaLevel > 0: self._np.setAntialias(AntialiasAttrib.MPolygon, self.aaLevel) self._np.reparentTo(parent)
def __init__(self, parent, pos=Vec3(0, 0, 0), size=1, color=Vec4(0, 0, 0, 1)): print(" Creating circle at " + str(pos)) self.aaLevel = int(GameSettings().getSetting('ANTIALIAS')) self.pos = pos self.size = size self.color = color self._np = self.draw() self._np.setTwoSided(True) self._np.setTransparency(1) self._np.setAttrib(DepthTestAttrib.make(RenderAttrib.MNone)) self._np.setEffect(BillboardEffect.makePointEye()) if self.aaLevel > 0: self._np.setAntialias(AntialiasAttrib.MPolygon, self.aaLevel) self._np.reparentTo(parent)