Class · inherits PVInstance
BasePart
The abstract base class for in-world objects that physically interact.
About BasePart
BasePart is an abstract base class for in-world objects that render
and are physically simulated while in the Workspace. There are several
implementations of BasePart, the most common being Part and
MeshPart. Others include WedgePart, SpawnLocation, and
the singleton Terrain object. Generally, when documentation refers to
a "part," most BasePart implementations will work and not just
Part.
For information on how BaseParts are grouped into simulated
rigid bodies, see Assemblies.
There are many different objects that interact with BasePart (other
than Terrain), including:
- Several
BasePartsmay be grouped within aModeland moved at the same time usingPVInstance.PivotTo. See Models. - A
Decalapplies a stretched image texture to the faces of aBasePart, while aTextureapplies a tiled image texture to the faces. See Textures and Decals. - A
SurfaceGuirendersGuiObjectson the face of a part. See In-Experience UI Containers. Attachmentscan be added to aBasePartto specifyCFramesrelative to the part. These are often used by physicalConstraintobjects as outlined in Mechanical Constraints and Mover Constraints.ParticleEmitterobjects emit particles uniformly in the volume of theBasePartto which they are parented. See Particle Emitters.- Light objects like
PointLightemit light from the center of aBasePartas illustrated in Light Sources. - If parented to a
Tooland given the name Handle, aBasePartcan be held by characters. See In-Experience Tools.
Properties 44
Anchored
: booleanDetermines whether a part is immovable by physics.The
Anchoredproperty determines whether the part will be immovable by physics. When enabled, a part will never change position due to gravity, other part collisions, overlapping other parts, or any other physics-related causes. As a result, two anchored parts will never fire theTouchedevent on each other.An anchored part may still be moved by changing its
CFrameorPosition, and it still may have a nonzeroAssemblyLinearVelocityandAssemblyAngularVelocity.Finally, if an unanchored part is joined with an anchored part through an object like a
Weld, it too will act anchored. If such a joint breaks, the part may be affected by physics again. See Assemblies for more details.Network ownership cannot be set on anchored parts. If a part's anchored status changes on the server, the network ownership of that part will be affected.
AssemblyAngularVelocity
: Vector3NotReplicatedThe angular velocity of the part's assembly.The angular velocity vector of this part's assembly. It's the rate of change of orientation in radians per second.
Angular velocity is the same at every point of the assembly.
Setting the velocity directly may lead to unrealistic motion. Using
TorqueorAngularVelocityconstraint is preferred, or useApplyAngularImpulse()if you want instantaneous change in velocity.If the part is owned by the server, this property must be changed from a server
Script(not from aLocalScriptor aScriptwithRunContextset toRunContext.Client). If the part is owned by a client through automatic ownership, this property can be changed from either a client script or a server script; changing it from a client script for a server-owned part will have no effect.AssemblyCenterOfMass
: Vector3ReadOnlyNotReplicatedThe center of mass of the part's assembly in world space.A position calculated via the
MassandPositionof all the parts in the assembly.If the assembly has an anchored part, that part's center of mass will be the assembly's center of mass, and the assembly will have infinite mass.
Knowing the center of mass can help the assembly maintain stability. A force applied to the center of mass will not cause angular acceleration, only linear. An assembly with a low center of mass will have a better time staying upright under the effect of gravity.
AssemblyLinearVelocity
: Vector3NotReplicatedThe linear velocity of the part's assembly.The linear velocity vector of this part's assembly. It's the rate of change in position of
AssemblyCenterOfMassin studs per second.If you want to know the velocity at a point other than the assembly's center of mass, use
GetVelocityAtPosition().Setting the velocity directly may lead to unrealistic motion. Using a
VectorForceconstraint is preferred, or useApplyImpulse()if you want instantaneous change in velocity.If the part is owned by the server, this property must be changed from a server
Script(not from aLocalScriptor aScriptwithRunContextset toRunContext.Client). If the part is owned by a client through automatic ownership, this property can be changed from either a client script or a server script; changing it from a client script for a server-owned part will have no effect.AssemblyMass
: floatReadOnlyNotReplicatedThe total mass of the part's assembly.The sum of the mass of all the
BasePartsin this part's assembly. Parts that areMasslessand are not the assembly's root part will not contribute to theAssemblyMass.If the assembly has an anchored part, the assembly's mass is considered infinite. Constraints and other physical interactions between unanchored assemblies with a large difference in mass may cause instabilities.
AssemblyRootPart
: BasePartReadOnlyNotReplicatedA reference to the root part of the assembly.This property indicates the
BasePartautomatically chosen to represent the assembly's root part. If the part is not parented to theWorkspace, this property will benil.The root part can be changed by changing the
RootPriorityof the parts in the assembly.Parts that all share the same
AssemblyRootPartare in the same assembly.For more information on root parts, see Assemblies.
AudioCanCollide
: booleanDetermines whether the part will physically interact with audio simulation, similar toCastShadowfor lighting.AudioCanCollidedetermines whether the part will physically interact with audio simulation, similar toCastShadowfor lighting.When disabled, audio passes through the part; it is not occluded or reflected.
BackSurface
: SurfaceTypeDetermines the type of surface for the back face of a part.The
BackSurfaceproperty determines the type of surface used for the positive Z direction of a part. When two parts' faces are placed next to each other, they may create a joint between them.BottomSurface
: SurfaceTypeDetermines the type of surface for the bottom face of a part.The
BottomSurfaceproperty determines the type of surface used for the negative Y direction of a part. When two parts' faces are placed next to each other, they may create a joint between them.BrickColor
: BrickColorNotReplicatedDetermines the color of a part.This property determines the color of a part. If the part has a
Material, this also determines the color used when rendering the material texture. For more control over the color, theColorproperty can be used and this property will use the closestBrickColor.Other visual properties of a part are determined by
TransparencyandReflectance.CanCollide
: booleanDetermines whether a part may collide with other parts.CanCollidedetermines whether a part will physically interact with other parts. When disabled, other parts can pass through the part uninterrupted. Parts used for decoration usually haveCanCollidedisabled, as they need not be considered by the physics engine.If a part is not
Anchoredand hasCanCollidedisabled, it may fall out of the world to be eventually destroyed byWorkspace.FallenPartsDestroyHeight.When
CanCollideis disabled, parts may still fire theTouchedevent (as well the other parts touching them). You can disable this withCanTouch.For more information on collisions, see Collisions.
CanQuery
: booleanDetermines whether the part is considered during spatial query operations.This property determines whether the part is considered during spatial query operations, such as
GetPartBoundsInBoxorRaycast. Note thatCanCollidemust be disabled forCanQueryto take effect, and spatial query functions will never include parts withCanQueryoffalse.Beyond this property, it is also possible to exclude parts which are descendants of a given list of parts using an
OverlapParamsorRaycastParamsobject when calling the spatial query functions.CanTouch
: booleanDetermines ifTouchedandTouchEndedevents fire on the part.This property determines if
TouchedandTouchEndedevents fire on the part. Iftrue, other touching parts must also haveCanTouchset totruefor touch events to fire. Iffalse, touch events cannot be set up for the part and attempting to do so will throw an error. Similarly, if the property is set tofalseafter a touch event is connected, the event will be disconnected and theTouchTransmitterremoved.Note that this collision logic can be set to respect collision groups through the
Workspace.TouchesUseCollisionGroupsproperty. Iftrue, parts in non-colliding groups will ignore both collisions and touch events, thereby making this property irrelevant.Performance
There is a small performance gain on parts that have both
CanTouchandCanCollideset tofalse, as these parts will never need to compute any kind of part to part collisions. However, they can still be hit byRaycastsandOverlapParamsqueries.CastShadow
: booleanDetermines whether or not a part casts a shadow.Determines whether or not a part casts a shadow. Disabling this property for a given part can cause visual artifacts on the shadows cast upon that part.
This property is not designed for performance enhancement, but in complex scenes, strategically disabling it on certain parts can improve performance. Due to the possibility of visual artifacts, we recommend leaving it enabled on all parts in most situations.
CenterOfMass
: Vector3ReadOnlyNotReplicatedDescribes the world position in which a part's center of mass is located.The
CenterOfMassproperty describes the local position of a part's center of mass. If this is a single part assembly, this is theAssemblyCenterOfMassconverted from world space to local. On simpleParts, the center of mass is always(0, 0, 0), but it can vary forWedgePartorMeshPart.CFrame
: CFrameDetermines the position and orientation of theBasePartin the world.The
CFrameproperty determines both the position and orientation of theBasePartin the world. It acts as an arbitrary reference location on the geometry, butExtentsCFramerepresents the actualCFrameof its physical center.When setting
CFrameon a part, other joined parts are also moved relative to the part, but it is recommended that you usePVInstance.PivotToto move an entire model, such as when teleporting a player's character.Unlike setting
BasePart.Position, settingCFramewill always move the part to the exact givenCFrame; in other words: no overlap checking is done and the physics solver will attempt to resolve any overlap unless both parts areAnchored.For keeping track of positions relative to a part's
CFrame, anAttachmentmay be useful.CollisionGroup
: stringNotReplicatedDescribes the name of a part's collision group.The
CollisionGroupproperty describes the name of the part's collision group (maximum of 100 characters). Parts start off in the default group whose name is"Default". This value cannot be empty.Although this property itself is non-replicated, the engine internally replicates the value through another private property to solve backward compatibility issues.
Color
: Color3NotReplicatedDetermines the color of a part.The
Colorproperty determines the color of a part. If the part has aMaterial, this also determines the color used when rendering the material texture.If this property is set,
BrickColorwill use the closest match to thisColorvalue.Other visual properties of a part are determined by
TransparencyandReflectance.CurrentPhysicalProperties
: PhysicalPropertiesReadOnlyNotReplicatedIndicates the current physical properties of the part.CurrentPhysicalPropertiesindicates the current physical properties of the part. You can set custom values for the physical properties per part, custom material, and material override. The Roblox engine prioritizes more granular definitions when determining the effective physical properties of a part. The values in the following list are in order from highest to lowest priority:- Custom physical properties of the part
- Custom physical properties of the part's custom material
- Custom physical properties of the material override of the part's material
- Default physical properties of the part's material
CustomPhysicalProperties
: PhysicalPropertiesDetermines several physical properties of a part.CustomPhysicalPropertieslets you customize various physical aspects of a part, such as its density, friction, and elasticity.If enabled, this property let's you configure these physical properties. If disabled, these physical properties are determined by the
Materialof the part.EnableFluidForces
: booleanUsed to enable or disable aerodynamic forces on parts and assemblies.When
true, and whenWorkspace.FluidForcesis enabled, causes the physics engine to compute aerodynamic forces on thisBasePart.ExtentsSize
: Vector3ReadOnlyNotReplicatedThe actual physical size of theBasePartas regarded by the physics engine.The actual physical size of the
BasePartas regarded by the physics engine, for example in collision detection.FrontSurface
: SurfaceTypeDetermines the type of surface for the front face of a part.The
FrontSurfaceproperty determines the type of surface used for the negative Z direction of a part. When two parts' faces are placed next to each other, they may create a joint between them.LeftSurface
: SurfaceTypeDetermines the type of surface for the left face of a part.The
LeftSurfaceproperty determines the type of surface used for the negative X direction of a part. When two parts' faces are placed next to each other, they may create a joint between them.LocalTransparencyModifier
: floatHiddenNotReplicatedDetermines a multiplier forBasePart.Transparencythat is only visible to the local client.The
LocalTransparencyModifierproperty is a multiplier toTransparencythat is only visible to the local client. It does not replicate from client to server and is useful for when a part should not render for a specific client, such as how the player does not see their character's body parts when they zoom into first person mode.This property modifies the local part's transparency through the following formula, with resulting values clamped between
0and1.1- ((1-Transparency) × (1-LocalTransparencyModifier))Locked
: booleanDetermines whether a part is selectable in Studio.The
Lockedproperty determines whether a part (or aModelit is contained within) may be selected in Studio by clicking on it. This property is most often enabled on parts within environment models that aren't being edited at the moment.Mass
: floatReadOnlyNotReplicatedDescribes the mass of the part, the product of its density and volume.Massis a read-only property that describes the product of a part's volume and density. It is returned by theGetMass()function.Massless
: booleanDetermines whether the part contributes to the total mass or inertia of its rigid body.If this property is enabled, the part will not contribute to the total mass or inertia of its assembly as long as it is welded to another part that has mass.
If the part is its own root part according to
AssemblyRootPart, this will be ignored for that part, and it will still contribute mass and inertia to its assembly like a normal part. Parts that are massless should never become an assembly root part unless all other parts in the assembly are also massless.This might be useful for things like optional accessories on vehicles that you don't want to affect the handling of the car or a massless render mesh welded to a simpler collision mesh.
See also Assemblies, an article documenting what root parts are and how to use them.
Material
: MaterialDetermines the texture and default physical properties of a part.The
Materialproperty allows you to set a part's texture and default physical properties (in the case thatCustomPhysicalPropertiesis unset). The defaultPlasticmaterial has a very light texture, while theSmoothPlasticmaterial has no texture at all. Some material textures likeDiamondPlateandGranitehave very visible textures. Each material's texture reflects sunlight differently, especiallyFoil.Setting this property then enabling
CustomPhysicalPropertieswill use the default physical properties of a material. For instance,DiamondPlateis a very dense material whileWoodis very light. A part's density determines whether it will float in terrain water.The
Glassmaterial changes rendering behavior on moderate graphics settings by applying a bit of reflectiveness (similar toReflectance) and perspective distortion. The effect is especially pronounced on sphere-shaped parts. Semi‑transparent parts behindGlassparts are not visible.MaterialVariant
: stringNotReplicatedThe name ofMaterialVariant.The system searches the
MaterialVariantinstance with the specifiedMaterialVariantname andMaterialtype. If it successfully finds a matchingMaterialVariantinstance, it uses that instance to replace the default material. The default material can be the built-in material or an overrideMaterialVariantspecified inMaterialService.Orientation
: Vector3HiddenNotReplicatedDescribes the rotation of the part in the world.The
Orientationproperty describes the part's rotation in degrees around the X, Y, and Z axes using aVector3. The rotations are applied in Y ⟩ X ⟩ Z order. This differs from proper Euler angles and is instead Tait-Bryan angles which describe yaw, pitch, and roll.It is also worth noting how this property differs from the
CFrame.Anglesconstructor which applies rotations in a different order (Z ⟩ Y ⟩ X). For better control over the rotation of a part, it's recommended thatCFrameis set instead.When setting this property, any
WeldsorMotor6Dsconnected to this part will have the matchingC0orC1property updated to allow the part to move relative to any other parts it is joined to.WeldConstraintswill also be temporarily disabled and re-enabled during the move.PivotOffset
: CFrameSpecifies the offset of the part's pivot from itsCFrame.This property specifies the offset of the part's pivot from its
CFrame, that isBasePart.GetPivotis the same asBasePart.CFramemultiplied byBasePart.PivotOffset.This is convenient for setting the pivot to a location in local space, but setting a part's pivot to a location in world space can be done as follows:
Position
: Vector3HiddenNotReplicatedDescribes the position of the part in the world.The
Positionproperty describes the coordinates of a part using aVector3. It reflects the position of the part'sCFrame, however it can also be set.When setting this property, any
WeldsorMotor6Dsconnected to this part will have the matchingC0orC1property updated to allow the part to move relative to any other parts it is joined to.WeldConstraintswill also be temporarily disabled and re-enabled during the move.ReceiveAge
: floatHiddenReadOnlyNotReplicatedTime since last recorded physics update.Indicates the time in seconds since the part's physics were last updated on the local client or the server. This value will be
0when the part has no physics (Anchoredistrue).Reflectance
: floatDetermines how much a part reflects the skybox.The
Reflectanceproperty determines how much a part reflects the sky. A value of0indicates the part is not reflective at all, and a value of1indicates the part should fully reflect.Reflectance is not affected by
Transparencyunless the part is fully transparent, in which case reflectance will not render at all. Reflectance may or may not be ignored depending on theMaterialof the part.ResizeableFaces
: FacesReadOnlyNotReplicatedDescribes the faces on which a part may be resized.The
ResizeableFacesproperty uses aFacesobject to describe the different faces on which a part may be resized. For most implementations ofBasePart, such asPartandWedgePart, this property includes all faces. However,TrussPartwill set itsResizeableFacesset to only two faces since those kinds of parts must have twoSizedimensions of length2.This property is most commonly used with tools for building and manipulating parts and has little use outside of that context. The
Handlesclass, which has theHandles.Facesproperty, can be used in conjunction with this property to display only the handles on faces that can be resized on a part.ResizeIncrement
: intReadOnlyNotReplicatedDescribes the smallest change in size allowable by theResize()method.The
ResizeIncrementproperty is a read-only property that describes the smallest change in size allowable by theResize()method. It differs between implementations of theBasePartabstract class; for instance,Parthas this set to1whileTrussParthas this set to2since individual truss sections are 2×2×2 in size.RightSurface
: SurfaceTypeDetermines the type of surface for the right face of a part.The
RightSurfaceproperty determines the type of surface used for the positive X direction of a part. When two parts' faces are placed next to each other, they may create a joint between them.RootPriority
: intThe main rule in determining the root part of an assembly.This property is an integer between
-127and127that takes precedence over all other rules for root part sort. When considering multiple parts that are notAnchoredand which share the sameMasslessvalue, a part with a higherRootPrioritywill take priority over those with lowerRootPriority.You can use this property to control which part of an assembly is the root part and keep the root part stable if size changes.
See also Assemblies, an article documenting what root parts are and how to use them.
Rotation
: Vector3NotReplicatedThe rotation of the part in degrees for the three axes.The rotation of the part in degrees for the three axes.
When setting this property, any
WeldsorMotor6Dsconnected to this part will have the matchingC0orC1property updated to allow the part to move relative to any other parts it is joined to.WeldConstraintswill also be temporarily disabled and re-enabled during the move.Size
: Vector3NotReplicatedDetermines the dimensions of a part (length, height, width).A part's
Sizeproperty determines its visual dimensions, whileExtentsSizerepresents the actual size used by the physics engine, such as in collision detection. The individual dimensions (length, height, width) can be as low as0.001and as high as2048. Size dimensions below0.05will be physically simulated as if the part's dimensions are0.05, while visual rendering preserves the actual size.A part's
Sizeis used in a variety of additional ways:- To influence its mass as given by
GetMass(). - By
ParticleEmitterto determine the area from which particles are spawned. - By
BlockMeshto partially determine the rendered rectangular prism. - By
SpecialMeshfor certainMeshTypesto determine the size of the rendered mesh. - By
SurfaceLightto determine the space to illuminate.
- To influence its mass as given by
TopSurface
: SurfaceTypeDetermines the type of surface for the top face of a part.The
TopSurfaceproperty determines the type of surface used for the positive Y direction of a part. When two parts' faces are placed next to each other, they may create a joint between them.Transparency
: floatDetermines how much a part can be seen through (the inverse of part opacity).The
Transparencyproperty controls the visibility of a part on a scale of0to1where0is completely visible (opaque) and1is completely invisible (not rendered at all).While fully transparent parts are not rendered at all, partially transparent objects have some significant rendering costs. Having many translucent parts may impact performance.
When transparent parts overlap, render order may act unpredictably, so you should avoid semi-transparent parts from overlapping.
See also
LocalTransparencyModifieras a multiplier toTransparencythat's only visible to the local client.
Methods 24
AngularAccelerationToTorque
(angAcceleration: Vector3, angVelocity: Vector3 = 0, 0, 0) → Vector3Returns the torque needed to achieve a given angular acceleration on this part's assembly, optionally accounting for gyroscopic effects.Returns the world-space torque vector that must be applied to the part's assembly to achieve the specified angular acceleration. This result can be used to determine the torque that should be applied via a
Torqueinstance orBasePart.ApplyAngularImpulse.The calculation uses Euler's rotation equation where I is the assembly's world-space inertia tensor, α is the desired angular acceleration, and ω is the angular velocity.
τ = I · α + ω × (I · ω)
If the part is not a descendant of
Workspace, this method returns a vector of infinity. If the assembly is anchored, it similarly returns a vector of infinity.Gyroscopic Effects
When a spinning assembly has an asymmetric inertia tensor, the torque required to achieve a specified angular acceerlation is augmented due to the changing orientation of the body. The optional
angVelocityparameter accounts for these gyroscopic effects. If omitted, these gyroscopic effects are omitted from the calculation.ApplyAngularImpulse
(impulse: Vector3) → ()Apply an angular impulse to the assembly.Applies an instant angular force impulse to this part's assembly, causing the assembly to spin.
The resulting angular velocity from the impulse relies on the assembly's
mass. So a higher impulse is required to move more massive assemblies. Impulses are useful for cases where you want a force applied instantly, such as an explosion or collision.If the part is owned by the server, this function must be called from a server
Script(not from aLocalScriptor aScriptwithRunContextset toRunContext.Client). If the part is owned by a client through automatic ownership, this function can be called from either a client script or a server script; calling it from a client script for a server-owned part will have no effect.ApplyImpulse
(impulse: Vector3) → ()Apply an impulse to the assembly at the assembly'scenter of mass.This function applies an instant force impulse to this part's assembly.
The force is applied at the assembly's
center of mass, so the resulting movement will only be linear.The resulting velocity from the impulse relies on the assembly's
mass. So a higher impulse is required to move more massive assemblies. Impulses are useful for cases where you want a force applied instantly, such as an explosion or collision.If the part is owned by the server, this function must be called from a server
Script(not from aLocalScriptor aScriptwithRunContextset toRunContext.Client). If the part is owned by a client through automatic ownership, this function can be called from either a client script or a server script; calling it from a client script for a server-owned part will have no effect.ApplyImpulseAtPosition
(impulse: Vector3, position: Vector3) → ()Apply an impulse to the assembly at specified position.This function applies an instant force impulse to this part's assembly, at the specified position in world space.
If the position is not at the assembly's
center of mass, the impulse will cause a positional and rotational movement.The resulting velocity from the impulse relies on the assembly's
mass. So a higher impulse is required to move more massive assemblies. Impulses are useful for cases where developers want a force applied instantly, such as an explosion or collision.If the part is owned by the server, this function must be called from a server
Script(not from aLocalScriptor aScriptwithRunContextset toRunContext.Client). If the part is owned by a client through automatic ownership, this function can be called from either a client script or a server script; calling it from a client script for a server-owned part will have no effect.BindToCollisionSummaries
(callback: Function) → RBXScriptConnectionSubscribes to detailed per-frame contact data for the collisions this part is involved in.Subscribes
callbackto the contact data that the physics engine generates for this part while detecting collisions. Once per frame, after the simulation has stepped,callbackreceives an array of summaries describing every contact patch this part was involved in during that frame. Each summary reports where the contact occurred, which direction it faced, and how fast the two parts were moving relative to each other at that point.This method is a separate mechanism from
BasePart.Touched.Throws an error if
callbackisnil, or if the part is not a descendant ofWorkspace.Summary Fields
Each entry in the array passed to
callbackis a table with the following keys:Normalis oriented relative to the subscribed part rather than to whichever part the engine happened to list first, so if both parts of a pair are subscribed, each subscription receives its own summary with itself asPart0and the normal flipped to match.RelativeVelocityis the velocity ofPart1relative toPart0, so the magnitude of its projection ontoNormalis the speed at which the two parts are approaching or separating head-on, and the component tangential toNormaldescribes sliding and glancing contact.Reporting Behavior
- Contact recording is enabled only while at least one subscription exists
anywhere in the
Workspace, and the cost of it scales with the number of subscribed parts rather than with the total number of collisions in the scene. - Contacts between multiple sleeping parts do not produce summaries.
- Contacts from Parts with
BasePart.CanCollideset tofalsedo not produce summaries. - Physics may run several substeps per frame, so a pair that stays in
contact across several of them produces up to one summary per patch per
substep, all delivered in the same invocation of
callback. UseTimeto order them. - Non-convex collision geometry produces one summary per pair of touching
convex hulls, and contact with
Terrainis split further by contact normal, so either can yield several summaries for the same pair within one substep. - Nothing is replicated. Each client generates summaries for the collisions it owns. See network ownership.
- Destroying the part disconnects its subscriptions.
- Contact recording is enabled only while at least one subscription exists
anywhere in the
CanCollideWith
(part: BasePart) → booleanReturns whether the parts can collide with each other.Returns whether the parts can collide with each other or not. This function takes into account the collision groups of the two parts. This function will error if the specified part is not a BasePart.
CanSetNetworkOwnership
() → TupleChecks whether you can set a part's network ownership.The CanSetNetworkOwnership function checks whether you can set a part's network ownership.
The function's return value verifies whether or not you can call
BasePart.SetNetworkOwnerorBasePart.SetNetworkOwnershipAutowithout encountering an error. It returns true if you can modify/read the network ownership, or returns false and the reason you can't, as a string.GetClosestPointOnSurface
(position: Vector3) → Vector3Returns the closest point on the part's surface to the given point.Returns the closest point on the part's surface to the given world-space position. If the provided position is inside the part, it is returned as-is.
For
MeshPartandPartOperationinstances, this method respects the part'sCollisionFidelityvalue. Return values can differ based on whether the mesh is being treated as a box, a hull, or a more complex shape.GetConnectedParts
(recursive: boolean = false) → List<BasePart>Returns a table of parts connected to the object by any kind of rigid joint.Returns a table of parts connected to the object by any kind of rigid joint.
If
recursiveis true this function will return all of the parts in the assembly rigidly connected to the BasePart.Rigid Joints
When a joint connects two parts together
(Part0 → Part1), a joint is rigid if the physics ofPart1are completely locked down byPart0. This only applies to the following joint types:GetJoints
() → InstancesReturn all Joints or Constraints that is connected to this Part.GetNetworkOwner
() → InstanceReturns the current player who is the network owner of this part, ornilin case of the server.GetNetworkOwnershipAuto
() → booleanReturns true if the game engine automatically decides the network owner for this part.GetNoCollisionConstraints
() → InstancesReturns the enabledNoCollisionConstraintobjects currently registered for this part in its physics world.Returns the enabled
NoCollisionConstraintobjects currently registered for this part in its physics world. ANoCollisionConstraintdisables collisions between the two specific parts it references, while each of those parts may still collide with the rest of the world.The returned array is empty if no such constraint is currently registered for this part. The order of the returned constraints is not guaranteed.
GetTouchingParts
() → InstancesReturns a table of allBasePart.CanCollidetrue parts that intersect with this part.Returns a table of all parts that are physically interacting with this part. If the part itself has CanCollide set to false, then this function returns an empty table unless the part has a
TouchInterestobject parented to it (meaning something is connected to its Touched event). Parts that are adjacent but not intersecting are not considered touching. This function predates theWorldRoot.GetPartsInPartfunction, which provides more flexibility and avoids the specialTouchInterestrules described above. UseWorldRoot.GetPartsInPartinstead.GetVelocityAtPosition
(position: Vector3) → Vector3Returns the linear velocity of the part's assembly at the given position relative to this part.Returns the linear velocity of the part's assembly at the given position relative to this part. It can be used to identify the linear velocity of parts in an assembly other than the root part. If the assembly has no angular velocity, than the linear velocity will always be the same for every position.
IntersectAsync
(parts: Instances, collisionfidelity: CollisionFidelity = Default, renderFidelity: RenderFidelity = Automatic) → InstanceYieldsCreates a newIntersectOperationfrom the overlapping geometry of the part and the other parts in the given array.Creates a new
IntersectOperationfrom the intersecting geometry of the part and the other parts in the given array. OnlyPartsare supported, notTerrainorMeshParts. Similar toClone(), the returned object has no setParent.The following properties from the calling part are applied to the resulting
IntersectOperation:Color,Material,MaterialVariant,Reflectance,TransparencyCanCollideAnchored,Density,Elasticity,ElasticityWeight,Friction,FrictionWeight
Migration
It is highly recommended to use the newer
GeometryService.IntersectAsyncinstead of this method. As well as having better performance and more features, the new method differs as follows:- The output is an array of instances rather than a single instance.
- The input parts do not need to be parented to the scene, allowing for background operations.
- When the
SplitApartoption is set totrue(default), each distinct body will be returned in its ownPartOperation. - All the returned parts are in the coordinate space of the main part, so
their
PVInstance.Originpositions are the same as the main part's. This keeps the vertices of the mesh in the same position relative to the object as before the operation, but it does also mean the(0, 0, 0)of a returned part is not necessarily at the center of its body.
Notes
- The original parts remain intact following a successful intersect
operation. In most cases, you should
Destroy()all of the original parts and parent the returnedIntersectOperationto the same place as the callingBasePart. - By default, the face colors of the resulting intersection are borrowed
from the
Colorproperty of the original parts. To change the entire intersection to a specific color, set itsUsePartColorproperty totrue. - If an intersect operation would result in a part with more than 20,000 triangles, it will be simplified to 20,000 triangles.
IsGrounded
() → booleanReturns true if the object is connected to a part that will hold it in place (eg anAnchoredpart), otherwise returns false.Resize
(normalId: NormalId, deltaAmount: int) → booleanChanges the size of an object just like using the Studio resize tool.SetNetworkOwner
(playerInstance: Player = nil) → ()Sets the given player as network owner for this and all connected parts.Sets the given player as network owner for this and all connected parts. When playerInstance is
nil, the server will be the owner instead of a player.SetNetworkOwnershipAuto
() → ()Lets the game engine dynamically decide who will handle the part's physics (one of the clients or the server).SubtractAsync
(parts: Instances, collisionfidelity: CollisionFidelity = Default, renderFidelity: RenderFidelity = Automatic) → InstanceYieldsCreates a newUnionOperationfrom the part, minus the geometry occupied by the parts in the given array.Creates a new
UnionOperationfrom the part, minus the geometry occupied by the parts in the given array. OnlyPartsare supported, notTerrainorMeshParts. Similar toClone(), the returned object has no setParent.Note that the resulting union cannot be empty due to subtractions. If the operation would result in completely empty geometry, it will fail.
Migration
It is highly recommended to use the newer
GeometryService.SubtractAsyncinstead of this method. As well as having better performance and more features, the new method differs as follows:- The output is an array of instances rather than a single instance.
- The input parts do not need to be parented to the scene, allowing for background operations.
- When the
SplitApartoption is set totrue(default), each distinct body will be returned in its ownPartOperation. - All the returned parts are in the coordinate space of the main part, so
their
PVInstance.Originpositions are the same as the main part's. This keeps the vertices of the mesh in the same position relative to the object as before the operation, but it does also mean the(0, 0, 0)of a returned part is not necessarily at the center of its body.
TorqueToAngularAcceleration
(torque: Vector3, angVelocity: Vector3 = 0, 0, 0) → Vector3Returns the angular acceleration that would result from applying a given torque to this part's assembly, optionally accounting for gyroscopic effects.Returns the world-space angular acceleration that would result from applying the specified torque to the part's assembly, optionally taking into account gyroscopic effects.
This is the inverse of
BasePart.AngularAccelerationToTorque. It is useful for predicting how an assembly will respond to an applied torque.The calculation uses:
α = I⁻¹ · (τ − ω × (I · ω))
where I is the assembly's world-space inertia tensor, τ is the applied torque, and ω is the angular velocity.
If the part is not a descendant of
Workspace, returns(0, 0, 0). If the assembly is anchored, returns(0, 0, 0).Gyroscopic Effects
When a spinning assembly has an asymmetric inertia tensor, the acceleration resulting from an applied torque also depends on the current angular velocity. The
angVelocityparameter accounts for these gyroscopic effects. If omitted (defaults to zero), the result neglects this contribution from the result.UnionAsync
(parts: Instances, collisionfidelity: CollisionFidelity = Default, renderFidelity: RenderFidelity = Automatic) → InstanceYieldsCreates a newUnionOperationfrom the part, plus the geometry occupied by the parts in the given array.Creates a new
UnionOperationfrom the part, plus the geometry occupied by the parts in the given array. OnlyPartsare supported, notTerrainorMeshParts. Similar toClone(), the returned object has no setParent.The following properties from the calling part are applied to the resulting
UnionOperation:Color,Material,MaterialVariant,Reflectance,TransparencyCanCollideAnchored,Density,Elasticity,ElasticityWeight,Friction,FrictionWeight
Migration
It is highly recommended to use the newer
GeometryService.UnionAsyncinstead of this method. As well as having better performance and more features, the new method differs as follows:- The output is an array of instances rather than a single instance.
- The input parts do not need to be parented to the scene, allowing for background operations.
- When the
SplitApartoption is set totrue(default), each distinct body will be returned in its ownPartOperation. - All the returned parts are in the coordinate space of the main part, so
their
PVInstance.Originpositions are the same as the main part's. This keeps the vertices of the mesh in the same position relative to the object as before the operation, but it does also mean the(0, 0, 0)of a returned part is not necessarily at the center of its body.
Notes
- The original parts remain intact following a successful union operation.
In most cases, you should
Destroy()all of the original parts and parent the returnedUnionOperationto the same place as the callingBasePart. - By default, the resulting union respects the
Colorproperty of each of its parts. To change the entire union to a specific color, set itsUsePartColorproperty totrue. - If a union operation would result in a part with more than 20,000 triangles, it will be simplified to 20,000 triangles.
Events 2
Touched
BasePart.Touched:Connect(function(otherPart))Fires when a part touches another part as a result of physical movement.The Touched event fires when a part comes in contact with another part. For instance, if PartA bumps into PartB, then
PartA.Touchedfires with PartB, andPartB.Touchedfires with PartA.This event only fires as a result of physical movement, so it will not fire if the
CFrameproperty was changed such that the part overlaps another part. This also means that at least one of the parts involved must not beAnchoredat the time of the collision.This event works in conjunction with
Workspace.TouchesUseCollisionGroupsto specify whether collision groups are acknowledged for detection.TouchEnded
BasePart.TouchEnded:Connect(function(otherPart))Fires when a part stops touching another part as a result of physical movement.Fires when a part stops touching another part under similar conditions to those of
BasePart.Touched.This event works in conjunction with
Workspace.TouchesUseCollisionGroupsto specify whether collision groups are acknowledged for detection.
BasePart also has every member of PVInstance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.