You are here: Lua Scripting Resources eGuide > Lua Scripting API Reference Guide > Physics Library > setPositionFunc

19.4.25 setPositionFunc

self = physics.Body:setPositionFunc(func)

Parameter

Type

Description

self

in physics.Body

The input Body

func

in function(body, dt)

A callback function that updates the position of the Body on each time step

self

out physics.Body

The input Body is returned as the output


Sets the position function of the body. The position function must be a function that accepts a Body and a time step value and at some point calls body:updatePosition to update the position of the body.

Returns the Body.

.Introduced in platform.apiLevel = '2.0'