toggle AlignPosition.RigidityEnabled on and off when the elevator is parked or not parked

This commit is contained in:
2024-09-13 21:16:57 -04:00
parent b5f26ba404
commit 709642d408

View File

@@ -252,7 +252,11 @@ local function GoingUpDirectionToDirectionEnum(CurrentFloor: number, RequestedFl
end
local function CheckFloorQueue(self: ClassConstructor)
SmoothVelocity(self, 0, self.Elevator.Configuration.ParkedSmoothingTime)
local ParkSmoothing = SmoothVelocity(self, 0, self.Elevator.Configuration.ParkedSmoothingTime)
ParkSmoothing.Completed:Once(function()
self.Elevator.AlignPosition.Position = self.Elevator.BoxModel.Position
self.Elevator.AlignPosition.RigidityEnabled = true
end)
local DirectionToDirectionQueue = self.Attributes.TravelingUpwards.Value and self.RelayAlgorithm.FloorQueue.Up or self.RelayAlgorithm.FloorQueue.Down
local DirectionToOppositeDirectionQueue = self.Attributes.TravelingUpwards.Value and self.RelayAlgorithm.FloorQueue.Down or self.RelayAlgorithm.FloorQueue.Up
@@ -412,6 +416,7 @@ function Elevator:__TravelToFloorAsync(Level_Int, LEVEL_VEC3_Y_WRAP)
end)
--Set the elevator's AlignPosition to the floor Y vector
self.Elevator.AlignPosition.RigidityEnabled = false
self.Elevator.AlignPosition.Position = Vector3.new(self.Elevator.AlignPosition.Position.X, LEVEL_VEC3_Y_WRAP.Y, self.Elevator.AlignPosition.Position.Z)
--Set the elevator's velocity
SmoothVelocity(self, self.Elevator.Configuration.MaxVelocity, self.Elevator.Configuration.MaxVelocitySmoothingTime)