示例#1
0
def main():
    init()
    for frame in range(250):
        if frame % 40 == 0:
            random_touch()
        for step in range(10):
            update()
        yield nb.mesh_update(mesh, pos=pos.to_numpy().reshape(N**2, 3))
示例#2
0
def main():
    solver.init()
    for frame in range(250):
        solver.substep()
        marcher.voxelize_particles(solver.x)
        pos = marcher.to_voxel_particles()
        print(pos)
        yield nb.mesh_update(mesh, pos)
示例#3
0
def main():
    for i in range(500):
        print('rendering frame', i)
        for s in range(steps):
            t = (i + s / steps) * 0.03
            bx, bz = ti.cos(t) * 0.7, -ti.sin(t) * 0.7
            substep(bx, bz)
        yield nb.mesh_update(cloth_mesh, pos.to_numpy()) \
            + nb.object_update(ball_object, location=[bx, 0, bz])
示例#4
0
def main():
    def T(x):
        return np.array([x[:, 0] * 2 - 1, x[:, 2] * 2 - 1,
                         x[:, 1] * 2]).swapaxes(0, 1)

    init()
    while True:
        for s in range(steps):
            substep()
        yield nb.mesh_update(mesh, T(x.to_numpy()))
示例#5
0
def main():
    def T(x):
        return np.array([x[:, 0], x[:, 2], x[:, 1]]).swapaxes(0, 1)

    init()
    yield T(x.to_numpy().reshape(N**2, 3))
    while True:
        for s in range(steps):
            substep()
        yield nb.mesh_update(mesh, T(x.to_numpy().reshape(N**2, 3)))
def main():
    for frame in range(2500):
        yield nb.mesh_update(me, x.to_numpy().reshape(vertex_num, 3))
        #s = 1
        for step in range(substep_num):
            #print('frame:',frame,', substep:',s)
            #s += 1
            coll_origin[0].x = c_obj.location[0]
            coll_origin[0].y = c_obj.location[1]
            coll_origin[0].z = c_obj.location[2]
            substep()
示例#7
0
def main():
    init()
    for frame in range(250):
        update(frame * 0.03)
        yield nb.mesh_update(mesh, pos=pos.to_numpy().reshape(N**2, 3))
示例#8
0
def main():
    init()
    while True:
        for s in range(6):
            substep()
        yield nb.mesh_update(mesh, x.to_numpy())