def makeBulletRicochet(self, dgi): pos = CIGlobals.getVec3(dgi) dir = CIGlobals.getVec3(dgi) scale = dgi.getFloat64() start = (0, 0, 0) end = dir * scale from panda3d.core import LineSegs, Vec4 from direct.interval.IntervalGlobal import Sequence, Func, Parallel lines = LineSegs() lines.setColor(Vec4(1, 1, 1, 1)) lines.setThickness(1) lines.moveTo(start) lines.drawTo(end) np = render.attachNewNode(lines.create()) np.setLightOff(1) np.setPos(pos) Sequence( Parallel(np.posInterval(0.1, pos + end, pos), np.scaleInterval(0.1, (0.001, 0.001, 0.001), (1, 1, 1))), Func(np.removeNode)).start() import random soundDir = "sound/weapons/ric{0}.wav" soundIdx = random.randint(1, 5) CIGlobals.emitSound(soundDir.format(soundIdx), pos)
def emitSound(self, soundPath, worldPos, volume): CIGlobals.emitSound(soundPath, worldPos, volume)