Check out Three.js on github and get ready to be blown away, so much power in 380KB.
Websockets Streaming Mesh - WebGL Client
Websockify by Joel Martin has got everything you need to get websockets going in Python3.
Supported Streaming Modifiers
Cast,
Curve,
Displace,
Hook,
Lattice,
MeshDeform,
ShrinkWrap,
SimpleDeform,
Smooth,
Warp,
Wave
Streaming the default blender monkey head (500 vertices) to the web-client creates a load of about 350KB per-second. This is still using ASCII Json for transport, so hopefully in the future a binary stream or other packing method could cut this down even more.
Prototype for real-time musical performance at live events, concerts. TODO: OSC integration to support pro music hardware, sample mixer integrated with physics system (collisions trigger sounds), particles, multiple full screen windows and camera switching driver input.
if not self.left_foot_loc: self.left_foot_loc = self.left_foot.shadow_parent.location step_left = True if not self.right_foot_loc: self.right_foot_loc = self.right_foot.shadow_parent.location step_right = True
x,y,z = self.chest.get_velocity_local()
sideways = None sideways_rate = abs( x ) if x < -2: sideways = 'RIGHT' elif x > 2: sideways = 'LEFT'
moving = None motion_rate = abs( y ) if y < -0.5: moving = 'FORWARD' elif y > 0.5: moving = 'BACKWARD'
if not step_left and random() > 0.2: if random() > 0.1: step_right = True else: step_left = True
hand_swing_targets = [] v = self.left_hand.biped_solver['swing-target'].location hand_swing_targets.append( v ) v.x = -( self.left_foot.biped_solver['target'].location.x )
v = self.right_hand.biped_solver['swing-target'].location hand_swing_targets.append( v ) v.x = -( self.right_foot.biped_solver['target'].location.x )
v = self.left_foot.biped_solver['target'].location if v.x < 0: # if foot moving backward only pull on heel/foot self.left_toe.biped_solver['TARGET'].weight = 0.0 elif v.x > 0: # if foot moving forward only pull on toe self.left_foot.biped_solver['TARGET'].weight = 0.0
v = self.right_foot.biped_solver['target'].location if v.x < 0: # if foot moving backward only pull on heel/foot self.right_toe.biped_solver['TARGET'].weight = 0.0 elif v.x > 0: # if foot moving forward only pull on toe self.right_foot.biped_solver['TARGET'].weight = 0.0
if moving == 'BACKWARD': # hands forward if moving backwards for v in hand_swing_targets: v.x += 0.1
if step_left: rad = euler.z - math.radians(90+self.primary_heading) cx = math.sin( -rad ) cy = math.cos( -rad ) v = self.left_foot.shadow_parent.location v.x = x+cx v.y = y+cy v.z = .0 self.left_foot_loc = v if step_right: rad = euler.z + math.radians(90+self.primary_heading) cx = math.sin( -rad ) cy = math.cos( -rad ) v = self.right_foot.shadow_parent.location v.x = x+cx v.y = y+cy v.z = .0 self.right_foot_loc = v
#################### falling #################### if falling:
if current_pelvis_height < 0.2: for foot in (self.left_foot, self.right_foot): target = foot.biped_solver[ 'TARGET:pelvis' ] if target.weight < 50: target.weight += 1.0
foot.add_local_torque( -30, 0, 0 )
else: for foot in (self.left_foot, self.right_foot): target = foot.biped_solver[ 'TARGET:pelvis' ] target.weight *= 0.9
for target in self.foot_solver_targets: # reduce foot step force target.weight *= 0.9
#for target in self.hand_solver_targets: # increase hand plant force # if target.weight < self.when_falling_hand_target_goal_weight: # target.weight += 1
for hand in (self.left_hand, self.right_hand): self.head.add_local_torque( -self.when_falling_head_curl, 0, 0 ) u = self.when_falling_pull_hands_down_by_tilt_factor * tilt hand.add_force( 0,0, -u )
for foot in (self.left_foot, self.right_foot): target = foot.biped_solver[ 'TARGET:pelvis' ] target.weight *= 0.9
for target in self.foot_solver_targets: if target.weight < self.when_standing_foot_target_goal_weight: target.weight += 1
#for target in self.hand_solver_targets: # reduce hand plant force # target.weight *= 0.9
head_lift = self.when_standing_head_lift for toe in ( self.left_toe, self.right_toe ): x,y,z = toe.get_location() if z < 0.1: self.head.add_force( 0,0, head_lift*0.5 )