def _initRope(self): rope = Rope(self.name) rope.ropeNode.setRenderMode(RopeNode.RMTape) rope.ropeNode.setUvMode(RopeNode.UVDistance) rope.ropeNode.setUvDirection(1) rope.ropeNode.setUvScale(-60) rope.ropeNode.setThickness(0.005) rope.ropeNode.setUseVertexColor(1) topGui = loader.loadModel('models/gui/toplevel_gui') self.ropeTex = topGui.findTexture('pir_t_gui_linePencil') rope.setTexture(self.ropeTex) self.rope = rope self.rope.setup(4, self.verts) self.rope.reparentTo(self)
def _initRope(self): rope = Rope(self.name) rope.ropeNode.setRenderMode(RopeNode.RMTape) rope.ropeNode.setUvMode(RopeNode.UVDistance) rope.ropeNode.setUvDirection(1) rope.ropeNode.setUvScale(-60) rope.ropeNode.setThickness(0.0050000000000000001) rope.ropeNode.setUseVertexColor(1) topGui = loader.loadModel('models/gui/toplevel_gui') self.ropeTex = topGui.findTexture('pir_t_gui_linePencil') rope.setTexture(self.ropeTex) self.rope = rope self.rope.setup(4, self.verts) self.rope.reparentTo(self)
def makeSpline(self): # Use the Rope class to draw a spline between the joints of # the cable. rope = Rope.Rope() for i in range(len(self.links)): pass #self.notify.debug('%s %s' % (self.links[i][0], self.links[i][0].getPos())) rope.setup(min(len(self.links), 4), self.links) for i in range(len(self.links)): pass #self.notify.debug('%s %s' % (self.links[i][0], self.links[i][0].getPos())) rope.curve.normalizeKnots() self.notify.debug('after normalize Knots') for i in range(len(self.links)): pass #self.notify.debug('%s %s' % (self.links[i][0], self.links[i][0].getPos())) rn = rope.ropeNode #rn.setRenderMode(RopeNode.RMTube) rn.setRenderMode(RopeNode.RMBillboard) rn.setNumSlices(3) rn.setTubeUp(Vec3(0, -1, 0)) #rn.setUvMode(RopeNode.UVParametric) rn.setUvMode(RopeNode.UVDistance) rn.setUvDirection(False) rn.setThickness(1.0) #rn.setThickness(5) return rope
def __loadStuff(self): rodId = self.av.getFishingRod() rodPath = FishGlobals.RodFileDict.get(rodId) if not rodPath: self.notify.warning('Rod id: %s model not found' % rodId) rodPath = RodFileDict[0] self.pole = Actor.Actor() self.pole.loadModel(rodPath) self.pole.loadAnims({'cast': 'phase_4/models/props/fishing-pole-chan'}) self.pole.pose('cast', 0) self.ptop = self.pole.find('**/joint_attachBill') if self.line == None: self.line = Rope.Rope(self.uniqueName('Line')) self.line.setColor(1, 1, 1, 0.4) self.line.setTransparency(1) self.lineSphere = BoundingSphere(Point3(-0.6, -2, -5), 5.5) if self.bob == None: self.bob = loader.loadModel('phase_4/models/props/fishing_bob') self.bob.setScale(1.5) self.ripples = Ripples.Ripples(self.nodePath) self.ripples.setScale(0.4) self.ripples.hide() if self.splashSounds == None: self.splashSounds = ( base.loadSfx('phase_4/audio/sfx/TT_splash1.ogg'), base.loadSfx('phase_4/audio/sfx/TT_splash2.ogg')) return
def makeSpline(self): rope = Rope.Rope() rope.setup(min(len(self.links), 4), self.links) rope.curve.normalizeKnots() rn = rope.ropeNode rn.setRenderMode(RopeNode.RMTube) rn.setNumSlices(3) rn.setTubeUp(Vec3(0, -1, 0)) rn.setUvMode(RopeNode.UVParametric) rn.setUvDirection(1) rn.setThickness(0.5) return rope
def getRope(self, thickness = 0.14999999999999999): rope = Rope.Rope() rope.ropeNode.setRenderMode(RopeNode.RMTube) rope.ropeNode.setNumSlices(10) rope.ropeNode.setUvMode(RopeNode.UVDistance) rope.ropeNode.setUvDirection(1) rope.ropeNode.setUvScale(0.25) rope.ropeNode.setThickness(thickness) ropePile = loader.loadModel('models/char/rope_high') ropeTex = ropePile.findTexture('rope_single_omit') ropePile.removeNode() rope.setTexture(ropeTex) return rope
def setupCord(self): if self.cord: self.cord.detachNode() self.cord = None self.cord = Rope.Rope(self.uniqueName('phoneCord')) self.cord.setColor(0, 0, 0, 1) self.cord.setup(4, ((self.receiverGeom, (0, 0, 0)), (self.model.find('**/joint_curveNode1'), (0, 0, 0)), (self.model.find('**/joint_curveNode2'), (0, 0, 0)), (self.model.find('**/joint_curveNode3'), (0, 0, 0)), (self.model.find('**/joint_curveNode4'), (0, 0, 0)), (self.model.find('**/joint_curveNode5'), (0, 0, 0)), (self.model.find('**/joint_curveNode6'), (0, 0, 0)), (self.model.find('**/CurveNode7'), (0, 0, 0)))) self.cord.reparentTo(self.model) self.cord.node().setBounds(BoundingSphere(Point3(-1.0, -3.2, 2.6), 2.0))
def makeSpline(self): # Use the Rope class to draw a spline between the joints of # the cable. rope = Rope.Rope() rope.setup(min(len(self.links), 4), self.links) rope.curve.normalizeKnots() rn = rope.ropeNode rn.setRenderMode(RopeNode.RMTube) rn.setNumSlices(3) rn.setTubeUp(Vec3(0, -1, 0)) rn.setUvMode(RopeNode.UVParametric) rn.setUvDirection(1) rn.setThickness(0.5) return rope
def initRopes(self): if self.gameType == TugOfWarGameGlobals.TOON_VS_COG: numRopes = self.numPlayers else: numRopes = self.numPlayers - 1 for x in range(0, numRopes): rope = Rope.Rope(self.uniqueName('TugRope' + str(x))) if rope.showRope: rope.ropeNode.setRenderMode(RopeNode.RMBillboard) rope.ropeNode.setThickness(0.2) rope.setTexture(self.ropeTexture) rope.ropeNode.setUvMode(RopeNode.UVDistance) rope.ropeNode.setUvDirection(1) rope.setTransparency(1) rope.setColor(0.89, 0.89, 0.6, 1) self.tugRopes.append(rope) self.setUpRopes(1)
def generateInit(self): self.nodePath = NodePath(self.uniqueName('FishingSpot')) self.line = Rope.Rope(self.uniqueName('Line')) self.line.setColor(1, 1, 1, 0.4) self.line.setTransparency(1) self.lineSphere = BoundingSphere(Point3(-0.6, -2, -5), 5.5) self.collSphere = CollisionSphere(0, 0, 0, self.getSphereRadius()) self.collSphere.setTangible(0) self.collNode = CollisionNode(self.uniqueName('FishingSpotSphere')) self.collNode.setCollideMask(ToontownGlobals.WallBitmask) self.collNode.addSolid(self.collSphere) self.collNodePath = self.nodePath.attachNewNode(self.collNode) self.protSphere = CollisionSphere(0, 0, 0, 1.5) self.protNode = CollisionNode(self.uniqueName('ProtectionSphere')) self.protNode.setCollideMask(ToontownGlobals.WallBitmask) self.protNode.addSolid(self.protSphere) self.protNodePath = NodePath(self.protNode) self.protNodePath.setScale(1, 1.5, 1.5) self.protNodePath.setPos(0, 7, 0)
def makeSpline(self): rope = Rope.Rope() for i in xrange(len(self.links)): pass rope.setup(min(len(self.links), 4), self.links) for i in xrange(len(self.links)): pass rope.curve.normalizeKnots() self.notify.debug('after normalize Knots') for i in xrange(len(self.links)): pass rn = rope.ropeNode rn.setRenderMode(RopeNode.RMBillboard) rn.setNumSlices(3) rn.setTubeUp(Vec3(0, -1, 0)) rn.setUvMode(RopeNode.UVDistance) rn.setUvDirection(False) rn.setThickness(1.0) return rope