BasePart||doc136278

September 20, 2022

BasePart

This abstract class object cannot be created

Brief Introduction

Basepart inherits from movablenode and provides additional functions of material information, physical attribute information and physical simulation. It is an abstract base class of parts. The main purpose of parts is to build scenes and do physical simulation and interaction.

Attribute

PartMaterial Material
Part material
float Transparency
Opacity
bool Anchored
Anchor or not
bool UseGravity
Enable gravity
bool CanCollide
Whether collision is enabled
PhysicProperties CustomPhysicProperties
Customize physical properties
float Density [ReadOnly]
density
float Frition [ReadOnly]
friction coefficient
float Elasticity [ReadOnly]
Elasticity coefficient
float Mass [ReadOnly]
quality
Vector3 AngularVelocity
angular velocity
Vector3 LinearVelocity
Linear velocity

Inherited FromMovableNode

Vector3 WorldPosition
Global coordinates
Vector3 WorldRotation
Global rotation
Vector3 WorldScale
Global zoom
Vector3 LocalPosition
Local coordinates
Vector3 LocalRotation
Local rotation
Vector3 LocalScale
Local zoom
Vector3 ForwardVector
Forward vector
Vector3 LeftVector
Vector in the left direction
Vector3 UpVector
Up vector

Inherited FromInstance

string Name
Name of the instance
Instance Parent
Parent of the instance
Map Map [ReadOnly]
Scenario of the instance
string ClassName [ReadOnly]
Class name of the instance
int ID [ReadOnly]
Unique ID of the instance

Function

void ApplyForceVector3 force, Vector3 point )
Apply force to the part
void ApplyTorqueVector3 torque )
Apply torque to this part
table<BaseConstraint> GetConstraintsConstraintType constraintType )
Get all constraints related to this part
bool IsConstrainted()
Get whether there are constraints related to the part
void MoveUntilCollideVector3 displacement, bool worldSpace )
Move according to the collision and stop when the collision occurs

Inherited FromMovableNode

void Rotate( Vector3 rotation, bool worldSpace )
rotate
void RotateAround( Vector3 center, Vector3 axis, float angle )
Rotate around an axis at a point
void Move( Vector3 displacement, bool worldSpace )
move

Inherited FromInstance

bool IsValid()
Get whether the instance object reference is valid
void Destroy()
Destroy instance
Instance Clone()
Clone the current instance
bool IsAncestorOfInstance instance )
Get whether it is the ancestor of an instance
bool IsDescendantOfInstance instance )
Get whether it is a descendant of an instance
bool IsClassstring className )
Get whether the instance type is a certain type
Instance FindFirstAncestorstring name )
Get the ancestor node instance by name
Instance FindFirstAncestorByClassstring className )
Get the ancestor node instance according to the type name
Instance FindFirstChildstring name, bool recursive )
Get child node instances by name
Instance FindFirstChildByClassstring name, bool recursive )
Get the child node instance according to the type name
table<Instance> GetChildrenbool recursive )
Get all child node instances
void AddChildInstance instance )
Add an instance to a child
void DestroyAllChildren()
Destroy all child node instances
BindableEvent GetEventstring eventName )
Get the bindable event of the instance

event

BindableEvent OnClick
Triggered when the part is clicked
BindableEvent OnCollisionBegin [ServerOnly]
Triggered when a part touches
BindableEvent OnCollisionEnd [ServerOnly]
Triggered when the part finishes touching

Inherited FromInstance

BindableEvent OnChildAdded
Triggered after adding child nodes to the instance
BindableEvent OnChildRemoved
Triggered after removing child nodes from an instance
BindableEvent OnDestroy
Triggered when the instance is about to be destroyed