TruWorlds

PhysicsInstance

Inherits: DynamicInstance

PhysicsBody is a dynamic instance that can be moved and interacted with in the game world.

Properties

Anchored bool

Indicates whether the PhysicsBody is anchored in place.

AngularVelocity Vector3

The angular velocity of the PhysicsBody.

CanCollide bool

Indicates whether the PhysicsBody can collide with other objects.

local ghost = Part()
ghost.CanCollide = false
ghost.Transparency = 0.5
ghost.Parent = world
IsDynamic bool

Indicates whether the PhysicsBody participates in dynamic simulation.

LinearVelocity Vector3

The linear velocity of the PhysicsBody.

local ball = Part()
ball.Shape = PartShape.Ball
ball.Parent = world
ball.LinearVelocity = Vector3(0, 50, 0)
NetworkOwnerClientId int

The client ID that has local physics authority over this body. 0 means the server simulates it.

TouchSensitive bool

Functions

GetTouching() Returns PhysicsInstance[]

Returns an array of all PhysicsInstances currently touching this PhysicsInstance.

local sensor = world.FindFirstChild("Sensor")
if sensor:
    for hit in sensor.GetTouching():
        if hit.IsA("Part"):
            hit.Color = Color3(1, 0, 0)
MakeJoint(other: PhysicsInstance) Returns Weld
local bodyA = world.FindFirstChild("BodyA")
local bodyB = world.FindFirstChild("BodyB")
if bodyA and bodyB:
    local weld = bodyA.MakeJoint(bodyB)
RemoveJoint(other: PhysicsInstance) Returns int

Removes any welds between this PhysicsBody and the other PhysicsBody.

Signals

TouchEnded Instance

Event fired when another PhysicsBody stops touching this PhysicsBody.

Touched Instance

Event fired when this PhysicsBody is touched by another PhysicsBody.