1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 true true true false false 2 5 1 0 0 0 0.69999999999999996 0 0 0 0.69999999999999996 0.40000000000000002 0.40000000000000002 0.40000000000000002 $K3D_SHARE_PATH 12 4 0.80000000000000004 0.80000000000000004 0.80000000000000004 false 0 100 true false true false true true true 4 0 4 30 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 true 6 0 0 0 false false -0.6666666666666666 0.6666666666666666 0.5 -0.5 1 1000 0 1 0 1 false 0 0 0 0.69999999999999996 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.89635612581977098 0.23127396104791259 0.37823015565470158 -9.3487025653578844 0.44333474452762128 -0.46760113951546917 -0.76472444620167834 18.901669486461845 1.8246865064915074e-14 0.85314801134682561 -0.52166892828206346 12.894074084750317 0 0 0 1 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 $K3D_SHARE_PATH 1 0.5 0.5 0.1 1 1 1 26 0 0 0 0 false 1 1 1 1 1 1 1 $K3D_SHARE_PATH 3000 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 true 28 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 -20 0 1 0 20 0 0 1 30 0 0 0 1 27 35 29 32 320 240 1 0 0 0 0 16 16 256 10 1024 false 3 3 gaussian 2 2 1 1 false 0.3 1.6 30 1 constant true false false node_selection 36 1 true 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 true 0 0 0 0.5 0.5 0.5 1 1 1 1 0 0 true 0 0 0 0.5 0.5 0.5 1 1 1 1 0 0 true 0.20000000000000001 0.20000000000000001 0.20000000000000001 0.5 0.5 0.5 0.59999999999999998 0.59999999999999998 0.59999999999999998 1 0 0 true 0 0 0 0.5 0.5 0.5 1 1 1 1 0 0 2 true 0 0 0 0.5 0.5 0.5 1 1 1 1 0 0 2 true 0.20000000000000001 0.20000000000000001 0.20000000000000001 0.5 0.5 0.5 0.59999999999999998 0.59999999999999998 0.59999999999999998 1 0 0 2 true true true true true true true true true true false 0 1 1 0 0.59999999999999998 0.59999999999999998 true true false 0 1 1 0 0.59999999999999998 0.59999999999999998 true true true true true true true true 31 1 1 1 5 5 5 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 true true false true 37 8 false 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 1 0 10 #python import k3d import ode # Define what constitutes a "physical" node ... def is_physical_node(node): if node.factory().name() != "FrozenTransformation": return False if not node.has_property("mass"): return False return True # Setup internal state ... if not locals().has_key("last_time"): last_time = Node.time if not locals().has_key("world"): world = ode.World() if not locals().has_key("physical_nodes"): physical_nodes = {} if not locals().has_key("initialize"): initialize = True # Identify "physical" nodes ... if initialize: initialize = False for node in Document.nodes(): if not is_physical_node(node): continue if not physical_nodes.has_key(node): body = ode.Body(world) body.setPosition(node.output_matrix * k3d.point3(0, 0, 0)) if node.has_property("linear_velocity"): body.setLinearVel(node.linear_velocity) else: body.setLinearVel((0, 0, 0)) physical_nodes[node] = body # Handle the next time-step ... delta_time = Node.time - last_time last_time = Node.time # If we're moving forward in time, run the next simulation step ... if delta_time > 0: for node in physical_nodes.keys(): mass = ode.Mass() mass.setSphereTotal(node.mass, 1.0) body = physical_nodes[node] body.setMass(mass) world.setGravity(Node.gravity) world.step(delta_time) for node in physical_nodes.keys(): body = physical_nodes[node] resting_position = node.input_matrix * k3d.point3(0, 0, 0) new_position = body.getPosition() delta_position = k3d.point3(new_position[0], new_position[1], new_position[2]) - resting_position node.matrix = k3d.translate3(delta_position) # If we're moving backward in time, reset all nodes to their resting state ... else: for node in physical_nodes.keys(): node.matrix = k3d.identity3() body = physical_nodes[node] body.setPosition(node.output_matrix * k3d.point3(0, 0, 0)) if node.has_property("linear_velocity"): body.setLinearVel(node.linear_velocity) else: body.setLinearVel((0, 0, 0)) 0 0 0 -9.8100000000000005