Hello there! I’m currently making a mountable horse system and I’ve run into a problem.
The problem is that the animation “moves” the model, which distorts its position.
- If i put HRP Anchored on true, it will work properly.
- I can say that most likely the problem is in Colliding.
- By the way, the horse doesn’t have Humanoid, and I tried to add it and it helped solve the problem with HipHeight, but I don’t want to use humanoid actually.
- I will show 3 videos, the first video is how it looks on the client, the second video is how it looks on the server, and the 3rd video is how the animation should actually look and how do i want to see it. (I set the HRP Anchored on true.)
1 video:
2 video:
3 video:
Here’s the code:
function Horse.new(HorseName : string, CF : CFrame)
if not HorseName or not CF then return end
local HorseModule, Required
local success, error = pcall(function()
HorseModule, Required = RP.Assets.Horses:FindFirstChild(HorseName), require(RP.Assets.Horses:FindFirstChild(HorseName))
end)
if not success then
warn("Horse '"..tostring(HorseName).."' does not exist in-game. Declined Horse.new()")
return
end
-- stats, animations
local DefaultStats = Horse.DefaultStats
local HorseStats = Required.Stats or {}
local HorseAnimations = HorseModule:FindFirstChild("Animations")
local DefaultAnimations = RP.Assets.Animations.Horse
local self = setmetatable({
Stamina = HorseStats.Stamina or DefaultStats.Stamina,
Speed = HorseStats.Speed or DefaultStats.Speed,
Power = HorseStats.Power or DefaultStats.Power,
HorseName = tostring(HorseName),
HorseModule = HorseModule,
Rider = nil
}, Horse)
-- creating model of horse
local Model
local success, error = pcall(function()
Model = HorseModule:FindFirstChild("Model"):FindFirstChildWhichIsA("Model"):Clone()
end)
if not success then
warn("Model of horse '"..tostring(HorseName).."' does not exist in-game. Declined Horse.new()")
return
end
-- load idle anim
local IdleAnim = HorseAnimations and HorseAnimations:FindFirstChild("Idle") or DefaultAnimations:FindFirstChild("Idle")
Shared:PlayAnimation(Model, IdleAnim)
-- load velocities
local att0 = Instance.new("Attachment")
att0.Parent = Model.PrimaryPart
local Orientation = Instance.new("AlignOrientation")
Orientation.MaxTorque = 50000
Orientation.Responsiveness = 25
Orientation.Mode = Enum.OrientationAlignmentMode.OneAttachment
Orientation.Attachment0 = att0
Orientation.Parent = Model.PrimaryPart
self.Orientation = Orientation
Model.Parent = Horse.HorsesParent
Model:PivotTo(CF)
self.Model = Model
return self
end