Part

Inherits BasePart

Part is the most basic building block in LemonEngine. It represents a physical object.

Examples

-- Create a platform
local platform = Instance.new("Part")
platform.Size = Vector3.new(20, 1, 20)
platform.Position = Vector3.new(0, 0, 0)
platform.Anchored = true
platform.Parent = workspace

Properties

Position

Vector3 Inherited from BasePart

The 3D position of the part in world space

Rotation

Vector3 Inherited from BasePart

The rotation angles in degrees (X, Y, Z)

Size

Vector3 Inherited from BasePart

The dimensions of the part

Velocity

Vector3 Inherited from BasePart

The current velocity of the part

RotationVelocity

Vector3 Inherited from BasePart

The angular velocity of the part

Anchored

bool Inherited from BasePart

When true, the part is not affected by physics

CanCollide

bool Inherited from BasePart

When true, the part can collide with other parts

CanQuery

bool Inherited from BasePart

When true, the part can be detected by raycasts

CanTouch

bool Inherited from BasePart

When true, the part can trigger touch events

Mass

number Read-only Inherited from BasePart

The mass of the part calculated from size and material

Color

Color3 Inherited from BasePart

The color of the part

CastShadow

bool Inherited from BasePart

When true, the part casts shadows

Transparency

number Inherited from BasePart

The transparency of the part from 0 (opaque) to 1 (invisible)

Methods

GetMass()

number Inherited from BasePart

Returns the calculated mass of the part

local mass = part:GetMass()
print("Mass:", mass)

Events

Touched

Event(otherPart: BasePart) Inherited from BasePart

Fires when another part touches this part

part.Touched:Connect(function(otherPart)
print("Touched by:", otherPart.Name)
end)

TouchEnded

Event(otherPart: BasePart) Inherited from BasePart

Fires when another part stops touching this part