def __setupGravity(self): base.particlesEnabled = True base.enableParticles() gravityFN=ForceNode('world-forces') gravityFNP=render.attachNewNode(gravityFN) gravityForce=LinearVectorForce(0,0,-6) #gravity acceleration ft/s^2 gravityFN.addForce(gravityForce) base.physicsMgr.addLinearForce(gravityForce)
def __setupGravity(self): base.particlesEnabled = True base.enableParticles() gravityFN = ForceNode('world-forces') gravityFNP = render.attachNewNode(gravityFN) gravityForce = LinearVectorForce(0, 0, -6) #gravity acceleration ft/s^2 gravityFN.addForce(gravityForce) base.physicsMgr.addLinearForce(gravityForce)
def perturb(self, force, time=1000, backToColor=None): print "perturbing %s, %s"%(force, time) node1 = self._node1 node2 = self._node2 actor1 = self._actor1 actor2 = self._actor2 self._timeOut = globalClock.getLongTime() + time/1000 force2 = node2.getRelativeVector( node1, force) force2 = Vec3( -1*force2.x, -1*force2.y, -1*force2.z) forceN1 = ForceNode('Impulse1') lvf1 = LinearVectorForce( force ) lvf1.setMassDependent(1) forceN1.addForce(lvf1) node1.attachNewNode(forceN1) actor1.getPhysical(0).addLinearForce(lvf1) forceN2 = ForceNode("Impulse2") lvf2 = LinearVectorForce( force2) lvf2.setMassDependent(1) forceN2.addForce(lvf2) node2.attachNewNode(forceN2) actor2.getPhysical(0).addLinearForce(lvf2) self._impulse1 = lvf1 self._impulse2 = lvf2 if backToColor: self._backToColor = backToColor
def __init__(self, name=None): """__init__(self)""" if (name == None): self.name = 'ForceGroup-%d' % ForceGroup.id ForceGroup.id += 1 else: self.name = name self.node = ForceNode.ForceNode(self.name) self.nodePath = NodePath(self.node) self.fEnabled = 0 self.particleEffect = None