def mousepos(self): if pylon.mouse_ispressed(): if pylon.mouse_getbutton() == 2: self.radus = float(pylon.mouse_pos_sy() - pylon.mouse_pos_y()) / float(pylon.window_height()) * -100 + self.pradus self.setforcenter(self.center,self.radus,self.anglex-90+180,360-(self.angley+180)) else: self.pradus = self.radus
def mouserot(self): if pylon.mouse_ispressed(): if pylon.mouse_getbutton() == 0: difx = ( pylon.mouse_pos_sx() - pylon.mouse_pos_x() ) * -1 dify = ( pylon.mouse_pos_sy() - pylon.mouse_pos_y() ) * -1 self.anglex = ( ( float(dify) / float(pylon.window_height()) ) * 180.0 ) + self.panglex self.angley = ( ( float(difx) / float(pylon.window_width()) ) * 360.0 ) + self.pangley self.setforcenter(self.center,self.radus,self.anglex-90+180,360-(self.angley+180)) else: self.panglex = self.anglex self.pangley = self.angley
rpos = Position(rnd_n1p1(),rnd_n1p1(),rnd_n1p1()) * positionrange rot = Position(rnd_n1p1(),rnd_n1p1(),rnd_n1p1()) * 360.0 currentObject = TestSphereSim.newObject( "Object"+str(loop) ) currentObject.setPos(rpos) currentObject.setRot(rot) currentObject.setMass(.02) currentObject.setBounce(0.25) currentObject.setFriction(0.5) currentObject.setOptions( pylon.solid_volatile | pylon.solid_convex | pylon.solid_sphere ) currentObject.setProperties( pylon.object_draw_children ) rnum = 6 print pylon.object_add_sphere( currentObject.simname, currentObject.name, .07, 10, 10, possibleImages[rnum], 1, 1, possibleTriProps[rnum] ) currentObject.build() loop = loop + 1 subrenderer1 = SubRenderer( "steve", float(pylon.window_width())/float(pylon.window_height()) ) subrenderer1.bindSimulation(sim2) rnum = 5 TestSphereOutset = TestSphereSim.newObject("Outset") TestSphereOutset.setOptions( pylon.solid_stationary | pylon.solid_concave | pylon.solid_sphere ) #TestSphereOutset.setProperties( pylon.object_draw_children ) #TestSphereOutset.setProperties( pylon.object_debug ) TestSphereOutset.setProperties( 0 ) pylon.object_add_sphere( TestSphereOutset.simname, TestSphereOutset.name, 2.0, 20, 20, possibleImages[rnum], 1, 1, possibleTriProps[rnum]|pylon.triangle_invert_normals ) #pylon.object_add_sphere( TestSphereOutset.simname, TestSphereOutset.name, 2.0, 20, 20, possibleImages[rnum], 1, 1, possibleTriProps[rnum]|pylon.triangle_doublesided ) #pylon.object_add_sphere( TestSphereOutset.simname, TestSphereOutset.name, 2.0, 20, 20, subrenderer1, 1, 1, possibleTriProps[rnum]|pylon.triangle_invert_normals ) TestSphereOutset.build() TestSphereSim.setGravityVector( Position( 0, -9.8, 0 ) )