Workspaceクラス
ひとことで言うと
ゲームの世界そのものを表すサービスです。Workspaceの中に入れたパーツやモデルが、ゲームの画面に表示されます。スクリプトからは workspace と書いて使えます。
公式の説明(英語):Workspace houses 3D objects which are rendered to the 3D world. Objects not descending from it will not be rendered or physically interact with the world.
使用例
local origin = Vector3.new(0, 50, 0)
local direction = Vector3.new(0, -100, 0)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
local result = workspace:Raycast(origin, direction, params)
if result then
print("当たったもの:" .. result.Instance.Name, result.Position)
endスクリプトは、Luauの型チェック(luau-lsp)で確認しています。
クラスの関係
受け継いでいるクラス:Object → Instance → PVInstance → Model → WorldRoot → Workspace
プロパティ(48)
| 名前と書き方 | 説明 |
|---|---|
AirDensityWorkspace.AirDensity: float | The air density at ground level, used in the aerodynamic force model. |
AirTurbulenceIntensityWorkspace.AirTurbulenceIntensity: float | Controls the strength of turbulence present in the wind velocity field, affecting the aerodynamic force model. |
AllowThirdPartySalesWorkspace.AllowThirdPartySales: boolean | Determines whether assets created by other users can be sold in the game. |
AuthorityModeWorkspace.AuthorityMode: AuthorityMode | Sets the server authority mode. |
AvatarUnificationModeWorkspace.AvatarUnificationMode: AvatarUnificationMode | Enables the R6 to R15 adapter, allowing R15 avatars to join R6 experiences. |
ClientAnimatorThrottlingWorkspace.ClientAnimatorThrottling: ClientAnimatorThrottlingMode | Specifies the animation throttling mode for the local client. |
CurrentCameraWorkspace.CurrentCamera: Camera | 今使われているカメラ。The Camera object being used by the local player. |
DistributedGameTimeWorkspace.DistributedGameTime: double | The amount of time, in seconds, that the game has been running. |
EnableSLIMAvatarsWorkspace.EnableSLIMAvatars: RolloutState | Controls whether SLIM rendering is used for avatars in the experience. |
FallenPartsDestroyHeightWorkspace.FallenPartsDestroyHeight: float | Determines the height at which falling Class.BasePart|BaseParts and their ancestor Class.Model|Models are removed from Workspace. |
FallHeightEnabledWorkspace.FallHeightEnabled: boolean | Controls whether parts that fall below Workspace.FallenPartsDestroyHeight are automatically destroyed. |
FluidForcesWorkspace.FluidForces: FluidForces | Determines whether the physics engine computes aerodynamic forces on Class.BasePart|BaseParts whose Class.BasePart.EnableFluidForces|EnableFluidForces property is true. |
GlobalWindWorkspace.GlobalWind: Vector3 | Specifies the global wind vector for animated terrain grass, dynamic clouds, and particles. |
GravityWorkspace.Gravity: float | 重力の強さ。初期値は196.2です。小さくすると、ふわっと高くジャンプできます。Determines the acceleration due to gravity applied to falling Class.BasePart|BaseParts. |
IKControlConstraintSupportWorkspace.IKControlConstraintSupport: IKControlConstraintSupport | Enables support for constraints for IKControls. If disabled, IKControls ignore physics constraints. |
ImprovedPhysicsReplicationWorkspace.ImprovedPhysicsReplication: RolloutState | Controls whether the experience uses the improved physics replication path between the server and clients. |
InsertPointWorkspace.InsertPoint: Vector3 | The world position at which new objects are placed when inserted from the toolbox. |
LayeredClothingCacheOptimizationsWorkspace.LayeredClothingCacheOptimizations: RolloutState | Controls whether layered clothing cache optimizations are enabled. |
LuauTypeCheckModeWorkspace.LuauTypeCheckMode: LuauTypeCheckMode | Sets the Luau type checking mode for scripts in the experience. |
MeshPartHeadsAndAccessoriesWorkspace.MeshPartHeadsAndAccessories: MeshPartHeadsAndAccessories | Sets whether character Heads and Accessories should be downloaded as MeshParts. |
MeshStreamingAndImprovedLodsWorkspace.MeshStreamingAndImprovedLods: RolloutState | Controls whether the experience uses the new mesh streaming and improved LOD system. |
ModelStreamingBehaviorWorkspace.ModelStreamingBehavior: ModelStreamingBehavior | Controls how Class.Model|Models are replicated in experiences when instance streaming is enabled. |
NextGenerationReplicationWorkspace.NextGenerationReplication: RolloutState | When true, enables an alternate replication system that alters and improves how properties are replicated under the hood. |
NextGenerationReplicationAliasWorkspace.NextGenerationReplicationAlias: RolloutState | |
PathfindingUseImprovedSearchWorkspace.PathfindingUseImprovedSearch: PathfindingUseImprovedSearch | Controls whether an improved search algorithm is used by PathfindingService. |
PhysicsSteppingMethodWorkspace.PhysicsSteppingMethod: PhysicsSteppingMethod | Sets how the solver will advance the physics simulation forward in time. |
PlayerCharacterDestroyBehaviorWorkspace.PlayerCharacterDestroyBehavior: PlayerCharacterDestroyBehavior | Controls whether the engine automatically calls Destroy() on a player's character when it is replaced and on the Player object when the player leaves. |
PlayerScriptsUseInputActionSystemAliasWorkspace.PlayerScriptsUseInputActionSystemAlias: RolloutState | |
PredictiveStreamingModeWorkspace.PredictiveStreamingMode: PredictiveStreamingMode | Controls whether the engine can make predictive streaming decisions. |
NextGenerationPhysicsSolverWorkspace.NextGenerationPhysicsSolver: RolloutState | Controls whether the experimental next generation physics solver is enabled. |
RejectCharacterDeletionsWorkspace.RejectCharacterDeletions: RejectCharacterDeletions | Controls whether the server rejects attempts by clients to delete player characters from the workspace. |
RenderingCacheOptimizationsWorkspace.RenderingCacheOptimizations: RenderingCacheOptimizationMode | Controls whether rendering cache optimizations are enabled. |
ReplicateInstanceDestroySettingWorkspace.ReplicateInstanceDestroySetting: ReplicateInstanceDestroySetting | Controls how Instance:Destroy() calls are replicated from the server to clients. |
RetargetingWorkspace.Retargeting: AnimatorRetargetingMode | Controls whether animation retargeting is enabled for character animations. |
SandboxedInstanceModeWorkspace.SandboxedInstanceMode: SandboxedInstanceMode | Controls whether sandboxed instance mode (script capabilities) is enabled. |
SignalBehaviorWorkspace.SignalBehavior: SignalBehavior | Configures when the engine resumes event handlers. |
SignalBehaviorAliasWorkspace.SignalBehaviorAlias: SignalBehavior | |
StreamingEnabledWorkspace.StreamingEnabled: boolean | Whether content streaming is enabled for the place. |
StreamingEnabledAliasWorkspace.StreamingEnabledAlias: boolean | |
StreamingIntegrityModeWorkspace.StreamingIntegrityMode: StreamingIntegrityMode | Determines whether streaming integrity mode is active. |
StreamingMinRadiusWorkspace.StreamingMinRadius: int | Minimum distance that content will be streamed to players with high priority. |
StreamingTargetRadiusWorkspace.StreamingTargetRadius: int | Maximum distance that content will be streamed to players. |
StreamOutBehaviorWorkspace.StreamOutBehavior: StreamOutBehavior | Configures how the engine decides when to stream content away from players. |
TerrainWorkspace.Terrain: Terrain | A reference to the Terrain object parented to the Workspace. |
TouchesUseCollisionGroupsWorkspace.TouchesUseCollisionGroups: boolean | Determines whether Class.BasePart|parts in different groups set to not collide will ignore collisions and touch events. |
UseFixedSimulationWorkspace.UseFixedSimulation: RolloutState | When true, enables Class.RunService:BindToSimulation() which calls a function at a fixed frequency, updates physics stepping logic, and makes the Global.RobloxGlobals.time() function return the fixed stepped frame time. |
UseFixedSimulationAliasWorkspace.UseFixedSimulationAlias: RolloutState | |
UseNewLuauTypeSolverWorkspace.UseNewLuauTypeSolver: RolloutState | Controls whether the new Luau type solver is used for type inference. |
メソッド(9)
| 名前と書き方 | 説明 |
|---|---|
ApplyRecommendedStreamingSettingsWorkspace:ApplyRecommendedStreamingSettings(): boolean | Applies Roblox's recommended instance streaming settings to the Workspace. |
GetNumAwakePartsWorkspace:GetNumAwakeParts(): int | Returns the number of Class.BasePart|BaseParts that are deemed physically active, due to being recently under the influence of physics. |
GetPhysicsThrottlingWorkspace:GetPhysicsThrottling(): int | Returns an integer, between 0 and 100, representing the percentage of real time that physics simulation is currently being throttled to. |
GetRealPhysicsFPSWorkspace:GetRealPhysicsFPS(): double | Returns the number of frames per second that physics is currently being simulated at. |
GetServerTimeNowWorkspace:GetServerTimeNow(): double | Returns the server's Unix time in seconds. |
JoinToOutsidersWorkspace:JoinToOutsiders(objects: Instances, jointType: JointCreationMode): () | Creates joints between the specified Class.BasePart|Parts and any touching parts depending on the parts' surfaces and the specified joint creation mode. |
PGSIsEnabledWorkspace:PGSIsEnabled(): boolean | Returns true if the game has the PGS Physics solver enabled. |
UnjoinFromOutsidersWorkspace:UnjoinFromOutsiders(objects: Instances): () | Breaks all joints between the specified Class.BasePart|BaseParts and other Class.BasePart|BaseParts. |
ZoomToExtentsWorkspace:ZoomToExtents(): () | Positions and zooms the Workspace.CurrentCamera to show the extent of Class.BasePart|BaseParts currently in the Workspace. |
イベント(1)
| 名前と書き方 | 説明 |
|---|---|
PersistentLoadedWorkspace.PersistentLoaded(player: Player) | Fires when persistent models have been sent to the specified player. |
受け継いでいるメンバー
WorldRoot から受け継いでいるもの(19)
ArePartsTouchingOthers・Blockcast・BulkMoveTo・CollisionGroupsAreCollidable・CollisionGroupSetCollidable・GetMaxCollisionGroups・GetPartBoundsInBox・GetPartBoundsInRadius・GetPartsInPart・GetRegisteredCollisionGroups・IKMoveTo・IsCollisionGroupRegistered・Raycast・RegisterCollisionGroup・RenameCollisionGroup・Shapecast・Spherecast・StepPhysics・UnregisterCollisionGroup
Model から受け継いでいるもの(14)
LevelOfDetail・ModelStreamingMode・PrimaryPart・Scale・WorldPivot・AddPersistentPlayer・GetBoundingBox・GetExtentsSize・GetPersistentPlayers・GetScale・MoveTo・RemovePersistentPlayer・ScaleTo・TranslateBy
PVInstance から受け継いでいるもの(4)
Instance から受け継いでいるもの(46)
Archivable・Capabilities・IsInSandbox・Name・Parent・PredictionMode・Sandboxed・AddTag・ClearAllChildren・Clone・Destroy・FindFirstAncestor・FindFirstAncestorOfClass・FindFirstAncestorWhichIsA・FindFirstChild・FindFirstChildOfClass・FindFirstChildWhichIsA・FindFirstDescendant・GetActor・GetAttribute・GetAttributeChangedSignal・GetAttributes・GetChildren・GetDebugId・GetDescendants・GetFullName・GetStyled・GetStyledPropertyChangedSignal・GetTags・HasTag・IsAncestorOf・IsDescendantOf・IsPropertyModified・QueryDescendants・RemoveTag・ResetPropertyToDefault・SetAttribute・WaitForChild・AncestryChanged・AttributeChanged・ChildAdded・ChildRemoved・DescendantAdded・DescendantRemoving・Destroying・StyledPropertiesChanged
Object から受け継いでいるもの(4)
Workspaceを使う記事
英語の説明とメンバーの一覧は、Roblox Creator Documentation(Workspace)をもとにしています(CC BY 4.0)。日本語の解説は、このサイトで独自に書いたものです。