コード例 #1
0
ファイル: mesh.py プロジェクト: PyMine/PyMine
    def reset(self):
        """Reset he explosion to run again!"""
        self.angles = {}
        self.rots = {}
        for i in self.root_mesh.get_names():
            a = math3d.Vector(self.root_mesh.get_obj_by_name(i).base_pos)
            x, y, z = a.x, a.y, a.z
            if x == y == z == 0:
                x, y, z = misc.randfloat(-1, 1), misc.randfloat(
                    -1, 1), misc.randfloat(-1, 1)
            else:
                a = a.normalize()
                x, y, z = a.x, a.y, a.z

            y += misc.randfloat(1.5, 2.5)
            self.angles[i] = x + misc.randfloat(-1, 1), y + misc.randfloat(
                -1, 1), z + misc.randfloat(-1, 1)
            self.rots[i] = (misc.randfloat(-10, 10), misc.randfloat(-10, 10),
                            misc.randfloat(-10, 10))

        for i in self.root_vals:
            self.root_mesh.get_obj_by_name(i).pos = self.root_vals[i][0]
            self.root_mesh.get_obj_by_name(i).rotation = self.root_vals[i][1]

        self.age = 0
        self.dead = False
        self.down_delta = 0
コード例 #2
0
ファイル: mesh.py プロジェクト: AjaxVM/pyggel
    def reset(self):
        """Reset he explosion to run again!"""
        self.angles = {}
        self.rots = {}
        for i in self.root_mesh.get_names():
            a = math3d.Vector(self.root_mesh.get_obj_by_name(i).base_pos)
            x, y, z = a.x, a.y, a.z
            if x == y == z == 0:
                x, y, z = misc.randfloat(-1,1), misc.randfloat(-1,1), misc.randfloat(-1,1)
            else:
                a = a.normalize()
                x, y, z = a.x, a.y, a.z

            y += misc.randfloat(1.5,2.5)
            self.angles[i] = x+misc.randfloat(-1,1), y+misc.randfloat(-1,1), z+misc.randfloat(-1,1)
            self.rots[i] = (misc.randfloat(-10, 10),
                            misc.randfloat(-10, 10),
                            misc.randfloat(-10, 10))

        for i in self.root_vals:
            self.root_mesh.get_obj_by_name(i).pos = self.root_vals[i][0]
            self.root_mesh.get_obj_by_name(i).rotation = self.root_vals[i][1]

        self.age = 0
        self.dead = False
        self.down_delta = 0
コード例 #3
0
    def register_particle(self, part):
        dx = randfloat(-.1, .1)
        dy = randfloat(.15, .3)
        dz = randfloat(-.1, .1)

        rot = random.randint(-25, 25)

        part.extra_data["dir"] = (dx, dy, dz)
        part.extra_data["rot"] = rot

        x, y, z = self.emitter.pos

        part.image.pos = x + dx * randfloat(1, 2), y, z + dz * randfloat(1, 2)
コード例 #4
0
ファイル: particle.py プロジェクト: AjaxVM/pyggel
    def register_particle(self, part):
        dx = randfloat(-.1, .1)
        dy = randfloat(.15, .3)
        dz = randfloat(-.1, .1)

        rot = random.randint(-25, 25)

        part.extra_data["dir"] = (dx, dy, dz)
        part.extra_data["rot"] = rot

        x, y, z = self.emitter.pos

        part.image.pos = x+dx*randfloat(1, 2), y, z+dz*randfloat(1, 2)
コード例 #5
0
ファイル: particle.py プロジェクト: javierab/modulos
    def register_particle(self, part):
        dx = randfloat(-0.1, 0.1)
        dy = randfloat(0.15, 0.3)
        dz = randfloat(-0.1, 0.1)

        part.extra_data["dir"] = (dx, dy, dz)
        part.colorize = (1, 0, 0, 1)

        x, y, z = self.emitter.pos

        part.pos = x + dx * randfloat(1, 1.2), y, z + dz * randfloat(1, 1.2)

        part.colorize = random.choice(((1, 0, 0, 1), (1, 0.25, 0, 1), (1, 1, 0, 1)))
コード例 #6
0
    def register_particle(self, part):
        dx = randfloat(-.1, .1)
        dy = randfloat(.15, .3)
        dz = randfloat(-.1, .1)

        part.extra_data["dir"] = (dx, dy, dz)
        part.colorize = (1, 0, 0, 1)

        x, y, z = self.emitter.pos

        part.pos = x + dx * randfloat(1, 1.2), y, z + dz * randfloat(1, 1.2)

        part.colorize = random.choice(
            ((1, 0, 0, 1), (1, .25, 0, 1), (1, 1, 0, 1)))
コード例 #7
0
ファイル: mesh.py プロジェクト: PyMine/PyMine
    def __init__(self,
                 root_mesh,
                 speed=0.025,
                 frame_duration=10,
                 kill_when_finished=True):
        """Create the exploder
           root_mesh must be a BasicMesh object to explode
           speed is how fast you want each piece to move/rotate
           frame_duration is how many times it will update before dying
           kill_when_finished indicates whether the exploder should be removed
                              from the scene when it ends"""
        BaseSceneObject.__init__(self)

        self.kill_when_finished = kill_when_finished

        self.root_mesh = root_mesh
        self.angles = {}
        self.rots = {}
        for i in self.root_mesh.get_names():
            a = math3d.Vector(self.root_mesh.get_obj_by_name(i).base_pos)
            x, y, z = a.x, a.y, a.z
            if x == y == z == 0:
                x, y, z = misc.randfloat(-2, 2), misc.randfloat(
                    0, 2), misc.randfloat(-2, 2)
            else:
                a = a.normalize()
                x, y, z = a.x, a.y, a.z

            y += misc.randfloat(1.5, 2.5)
            self.angles[i] = x + misc.randfloat(-1, 1), y + misc.randfloat(
                -1, 1), z + misc.randfloat(-1, 1)
            self.rots[i] = (misc.randfloat(-10, 10), misc.randfloat(-10, 10),
                            misc.randfloat(-10, 10))

        self.root_vals = {}
        for i in self.root_mesh.get_names():
            self.root_vals[i] = (self.root_mesh.get_obj_by_name(i).pos,
                                 self.root_mesh.get_obj_by_name(i).rotation)

        self.speed = speed
        self.age = 0
        self.frame_duration = frame_duration
        self.dead = False
        self.down_delta = 0
コード例 #8
0
ファイル: mesh.py プロジェクト: AjaxVM/pyggel
    def __init__(self, root_mesh, speed=0.025, frame_duration=10,
                 kill_when_finished=True):
        """Create the exploder
           root_mesh must be a BasicMesh object to explode
           speed is how fast you want each piece to move/rotate
           frame_duration is how many times it will update before dying
           kill_when_finished indicates whether the exploder should be removed
                              from the scene when it ends"""
        BaseSceneObject.__init__(self)

        self.kill_when_finished = kill_when_finished

        self.root_mesh = root_mesh
        self.angles = {}
        self.rots = {}
        for i in self.root_mesh.get_names():
            a = math3d.Vector(self.root_mesh.get_obj_by_name(i).base_pos)
            x, y, z = a.x, a.y, a.z
            if x == y == z == 0:
                x, y, z = misc.randfloat(-2,2), misc.randfloat(0,2), misc.randfloat(-2,2)
            else:
                a = a.normalize()
                x, y, z = a.x, a.y, a.z

            y += misc.randfloat(1.5,2.5)
            self.angles[i] = x+misc.randfloat(-1,1), y+misc.randfloat(-1,1), z+misc.randfloat(-1,1)
            self.rots[i] = (misc.randfloat(-10, 10),
                            misc.randfloat(-10, 10),
                            misc.randfloat(-10, 10))

        self.root_vals = {}
        for i in self.root_mesh.get_names():
            self.root_vals[i] = (self.root_mesh.get_obj_by_name(i).pos,
                                 self.root_mesh.get_obj_by_name(i).rotation)

        self.speed = speed
        self.age = 0
        self.frame_duration = frame_duration
        self.dead = False
        self.down_delta = 0