How do i make a static body not fall

i have a box that has to be a static body and not move until i tell it to … how do i do this?

Static or kinematic?  Sounds more like kinematic to me.

https://docs.coronalabs.com/daily/guide/physics/physicsBodies/index.html#body-type

Hi @SonicX278,

Neither “static” nor “kinematic” bodies will ever fall, at least not under the influence of gravity or other physical forces.

Note that you can always change a body’s type in code:

https://docs.coronalabs.com/api/type/Body/bodyType.html

Take care,

Brent

Try this to see what Brent means by changing the body ‘later’:

local physics = require "physics" physics.start() local centerX = display.contentCenterX local centerY = display.contentCenterY local tmp = display.newRect( centerX, centerY, 350, 10 ) tmp.rotation = -5 physics.addBody( tmp, "static", { bounce = 0, friction = 1 } ) tmp.isSleepingAllowed = false local tmp2 = display.newCircle( centerX + 100, centerY - 100, 10 ) physics.addBody( tmp2, "dynamic", { bounce = 0.2, friction = 1, radius = 10 } ) timer.performWithDelay( 1000, function() tmp.bodyType = "dynamic" end )

i meant dynamic! oops! haha i need a dynamic body to stay in one place until i tell it to move

During this “still” stage, does it need to interact with any other bodies? If not, you can make it inactive using this:

https://docs.coronalabs.com/api/type/Body/isBodyActive.html

thanks that worked…

Static or kinematic?  Sounds more like kinematic to me.

https://docs.coronalabs.com/daily/guide/physics/physicsBodies/index.html#body-type

Hi @SonicX278,

Neither “static” nor “kinematic” bodies will ever fall, at least not under the influence of gravity or other physical forces.

Note that you can always change a body’s type in code:

https://docs.coronalabs.com/api/type/Body/bodyType.html

Take care,

Brent

Try this to see what Brent means by changing the body ‘later’:

local physics = require "physics" physics.start() local centerX = display.contentCenterX local centerY = display.contentCenterY local tmp = display.newRect( centerX, centerY, 350, 10 ) tmp.rotation = -5 physics.addBody( tmp, "static", { bounce = 0, friction = 1 } ) tmp.isSleepingAllowed = false local tmp2 = display.newCircle( centerX + 100, centerY - 100, 10 ) physics.addBody( tmp2, "dynamic", { bounce = 0.2, friction = 1, radius = 10 } ) timer.performWithDelay( 1000, function() tmp.bodyType = "dynamic" end )

i meant dynamic! oops! haha i need a dynamic body to stay in one place until i tell it to move

During this “still” stage, does it need to interact with any other bodies? If not, you can make it inactive using this:

https://docs.coronalabs.com/api/type/Body/isBodyActive.html

thanks that worked…