类型 函数 对象 刚体 库 physics.* 返回值 无 修订版本 版本 2024.3703 关键词 刚体, setLinearVelocity 另请参阅 object:getLinearVelocity()
此函数接受刚体的线性速度的 **x** 和 **y** 分量,单位为像素/秒。
object:setLinearVelocity( xVelocity, yVelocity )
数字. 分别为 **x** 和 **y** 方向上的速度值。
-- Create a rectangle local myRect = display.newRect( 0, 0, 100, 100 ) -- Add a body to the rectangle physics.addBody( myRect, "dynamic" ) -- Set the linear velocity myRect:setLinearVelocity( 10, 4 )