![]() ![]() body : getAngle ())) end ) Methodsī2.Body:applyAngularImpulse applies an angular impulseī2.Body:applyForce applies a force at a world pointī2.Body:applyLinearImpulse applies an impulse at a pointī2.Body:createFixture creates a fixture and attach it to this bodyī2.Body:destroyFixture destroys a fixtureī2.Body:getAngle returns the current world rotation angle in radiansī2.Body:getAngularDamping returns the angular damping of the bodyī2.Body:getAngularVelocity returns the angular velocityī2.Body:getGravityScale returns the gravity scale of the bodyī2.Body:getInertia returns the rotational inertia of the body about the local origin in kg-m^2ī2.Body:getLinearDamping returns the linear damping of the bodyī2.Body:getLinearVelocity returns the linear velocity of the center of massī2.Body:getLocalCenter returns the local position of the center of massī2.Body:getLocalVector returns the world coordinates of a vector given the local coordinatesī2.Body:getMass returns the total mass of the body in kilograms (kg)ī2.Body:getPosition returns the world body origin positionī2.Body:getWorldCenter returns the world position of the center of massī2.Body:isActive returns the active state of the bodyī2.Body:isAwake returns the sleeping state of the bodyī2.Body:setActive sets the active state of the bodyī2.Body:setAngularDamping sets the angular damping of the bodyī2.Body:setAngularVelocity sets the angular velocityī2.Body:setAwake sets the sleep state of the bodyī2.Body:setGravityScale strengthens or weakens the effect of the world gravity on a bodyī2.Body:setLinearDamping sets the linear damping of the bodyī2.Body:setLinearVelocity sets the linear velocity of the center of massī2. body : getPosition ()) ball : setRotation ( math.rad ( ball. b2.Body:getInertiareturns the rotational inertia of the body about the local origin in kg-m2 b2.Body:getLinearDampingreturns the linear damping of the body b2.Body:getLinearVelocityreturns the linear velocity of the center of mass b2.Body:getLocalCenterreturns the local position of the center of mass b2. After Gideros Player opens, the start and stop icons become enabled. Now select PlayerStart Local Player to start Gideros Player. These are good defaults! world : step ( 1 / 60, 8, 3 ) ball : setPosition ( ball. At the first part of this tutorial, we just want to run our code in Gideos Player and print Hello Ball to the console. ENTER_FRAME, function () - edit the step values if required. ![]() From the game engine's point of view, a physics engine is just a system for procedural animation. Programmers can use it in their games to make objects move in realistic ways and make the game world more interactive. body = body -add to scene stage : addChild ( ball ) stage : addEventListener ( Event. Box2D is a 2D rigid body simulation library for games. new ( "ball.png" )) -reference center of the ball for positioning ball : setAnchorPoint ( 0.5, 0.5 ) ball : setPosition ( 100, 100 ) -get radius local radius = ball : getWidth () / 2 -create box2d physical object local body = world : createBody ball. new ( 0, 10, true ) -create ball bitmap object from ball graphic local ball = Bitmap. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |