Code: Select all
player.state.x, player.state.y = fixture:getBody():getPosition() -- X,Y in world
player.state.heading = math.round(math.deg(fixture:getBody():getAngle())) -- heading angle, beware it can be multiplies of 0-360 and even negative
local speed_x, speed_y = fixture:getBody():getLinearVelocity() -- linear velocity on two axes
player.state.speed = math.sqrt(speed_x ^ 2 + speed_y ^ 2) -- merged vehicle speed, e.g. for speedometer