one more question on my name space confusion. i am applying torque inside the class but the nodes arent moving.
under class craft() i have the init(self, bulletworld) call self.draw_craft() which refers to:
def draw_craft(self):
shape = BulletBoxShape(Vec3(0.5,0.5,0.5))
self.cube_node = render.attachNewNode(BulletRigidBodyNode("obj_cube_node_"+str(self.ID)) )
print ('cube node is ', self.cube_node)
#self.bulletworld.attachRigidBody(self.cube_node.node())
self.cube_node.node().setMass(1)
#self.cube_node.node().setFriction(0.50)
self.cube_node.node().addShape(shape)
self.cube_mesh1 = loader.loadModel(craft.craft_types[0])
self.cube_mesh1.reparentTo(self.cube_node)
self.cube_mesh1.setHpr(180,0,0)
whiteTex = loader.loadTexture("whiteTexture.png")
self.cube_mesh1.setTexture(whiteTex,1)
craft.craft_list.append(self.cube_node)
print ("ctaft node is", self.cube_node)
print ("list of craft ", craft.craft_list)
return self.cube_node
which then is then called in main World class setup funtion as
def setUp(self):
self.setLight()
self.turn_debug_on()
self.first = craft(self.world)
self.first.move_craft(5,5,0)
self.next = craft(self.world)
self.next.move_craft(9,-5,19)
total = 10
for each in range(0,total):
self.each = craft(self.world)
then using gameloop still in main i call
def gameLoop(self,task):
dt = globalClock.getDt()
frameTime = globalClock.getFrameTime()
self.processInput(dt)
for each in craft.craft_list:
self.each.accell()
self.world.doPhysics(dt)
return Task.cont
and that each.accell() code is inside craft class as
def accell(self):
force = Vec3(0, 0, 0) # Forward
torque = Vec3(0, 0 ,0)
#curVec = render.getRelativeVector(self.cube_node,Vec3(0,1,0))
force.setY(1.0)
self.cube_node.node().setActive(True)
torque = render.getRelativeVector(self.cube_node,torque)
self.cube_node.node().applyTorque(torque)
force = render.getRelativeVector(self.cube_node, force)
print ("force is", force , " for ID" , self.cube_node)
self.cube_node.node().applyCentralForce(force)
thing is, the craft do not move. where am i going wrong? probably 100 places, but why aren’t the craft moving?