-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
This is a scuffed system, but if you need to reposition any sort of rig with CFrames and try to implement it as you do with joints normally, the module attempts to set the CFrame of the root every frame; this drops your frames significantly, and the animation can't play properly.
TL;DR repositioning PrimaryPart of the character is laggy
I made a makeshift fix for this by auto-adding a Motor6D acting as a root repositioner and allowing the module to recognize the CFrame folder made by Moon 2
Also, please implement the bone module that the other guy made in the main files; it works perfectly. Not familiar with git, so here is the code I edited
setPropValue rework
local function setPropValue(self: MoonTrack, inst: Instance?, prop: string, value: any, isDefault: boolean?): boolean
if inst and prop == "CFrame" then
if inst:IsA("Model") and inst.PrimaryPart then
local character = inst
local rootPart = character.PrimaryPart
local function ensureRootMotor(characterModel: Model)
local rootControl = characterModel:FindFirstChild("RootController")
if rootControl and rootControl:IsA("BasePart") then
local existingMotor = rootControl:FindFirstChild("RootMotor")
if existingMotor and existingMotor:IsA("Motor6D") then
return existingMotor
end
end
local rootControl = Instance.new("Part")
rootControl.Name = "RootController"
rootControl.Anchored = true
rootControl.CanCollide = false
rootControl.Transparency = 1
rootControl.Size = Vector3.new(1, 1, 1)
rootControl.CFrame = rootPart.CFrame
rootControl.Parent = character
local newMotor = Instance.new("Motor6D")
newMotor.Name = "RootMotor"
newMotor.Part0 = rootControl
newMotor.Part1 = rootPart
newMotor.C0 = CFrame.identity
newMotor.C1 = CFrame.identity
newMotor.Parent = rootControl
rootPart.Anchored = false
return newMotor
end
local motor = ensureRootMotor(character)
if motor and motor.Part0 then
pcall(function()
motor.Transform = motor.Part0.CFrame:ToObjectSpace(value)
end)
end
end
return true
end
if inst then
local binding = Specials.Get(self._scratch, inst, prop)
if binding then
if binding.Get == nil and isDefault and value == true then
value = false
end
return pcall(binding.Set, value)
end
end
return pcall(function()
if prop ~= "CFrame" then
(inst :: any)[prop] = value
end
end)
end
Also insert this code into CompileItem for CFrame sequence detection
local CFrameValues = frame:FindFirstChild("CFrame")
if CFrameValues then
local props = {
CFrame = {
Default = CFrame.identity,
Static = false,
Sequence = unpackKeyframes(CFrameValues),
}
}
if target then
targets[target] = {
Props = props,
Target = target,
}
end
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels