Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to make a wheel spin... — Gideros Forum

How to make a wheel spin...

Tom2012Tom2012 Guru
edited March 2013 in General questions
Hey guys, this code doesn't work:

What have I got wrong please?
	local ground = self.scene.world:createBody({})
 
	local x,y = self.myMonster:localToGlobal(0,0)
 
 
	local jointDef = b2.createRevoluteJointDef(self.body, ground, 900,y+100)
	self.revoluteJoint = self.scene.world:createJoint(jointDef)
	self.revoluteJoint:enableMotor(true)
	self.revoluteJoint:setMotorSpeed(360)

Comments

  • Ah never mind - think I figured it out:
    	--create empty box2d body for joint
    	local ground = self.scene.world:createBody({})
     
    	local x,y = self.myMonster:localToGlobal(0,0)
     
     
    	local jointDef = b2.createRevoluteJointDef(self.body, ground, 900,y+50)
    	self.revoluteJoint = self.scene.world:createJoint(jointDef)
    self.revoluteJoint:enableMotor(true)
    self.revoluteJoint:setMotorSpeed(math.rad(360))
     
    self.revoluteJoint:setMaxMotorTorque(2)
    Thanks!

    Likes: JuanZambrano

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.