object.isBullet

Type Boolean
Object Body
Library physics.*
Revision Release 2024.3703
Keywords body, isBullet

Overview

A boolean for whether the body should be treated as a “bullet.” Bullets are subject to continuous collision detection rather than periodic collision detection at world time steps. This is more computationally expensive but it can prevent fast-moving objects from passing through solid barriers. The default is false.

Example

local bullet = display.newCircle( 100, 100, 10 )
physics.addBody( bullet, "dynamic", { radius=10 } )
bullet.gravityScale = 0

-- Make the object a "bullet" type object
bullet.isBullet = true

bullet:setLinearVelocity( 800, 0 )