Help with rolling mechanic in combat game

  1. What do you want to achieve?

I want to fix an issue with my rolling system

  1. What is the issue?

When I use my rolling ability it causes my character to be pushed backwards during left and right rolls using camera lock-on. I’m pretty sure it’s because of the lock-on camera making my character’s position weird but idk

I’m using a different script for free cam than when you lock on. The free cam uses LookVector for WASD and body velocity while the lock-on camera rolling is using RightVector for the A and D keys.

3 Likes

Could it be the rolling animation itself? It might be moving the character backwards a bit in the animation editor.

Are you using align orientation for the lock on system? I had the exact same issue with my lock on dashing system and align orientation with a high responsiveness fixed it.

Is your tool massless? I know roblox physics tend to slightly push you sideways when midair if you have a heavy tool.

Other than that it could be the animation itself, maybe try making it so the character doesn’t touch the ground but hover 0.1 studs above ground, this can be done using the “HipHeight” property in the humanoid.

How would you add align orientation to it?

Are you setting the Cframe of the HumanoidRootPart in a renderstepped with your lock on script or something similar?

yeah its using a cframe for the lock on

Outside of the renderstepped create an align orientation and use this function to calculate the correct angle

local alignOrientation = Instance.new('AlignOrientation', rootPart)
local orientationAttachment = rootPart:WaitForChild('RootAttachment')
alignOrientation.Attachment0 = orientationAttachment
alignOrientation.Mode=Enum.OrientationAlignmentMode.OneAttachment
alignOrientation.Enabled = false
alignOrientation.Responsiveness = 10000
alignOrientation.MaxTorque = 1000000

local function findAngle(positionA, positionB)
	local CF=CFrame.new(positionA, positionB)
	local targetX, targetY, targetZ=CF:ToEulerAnglesXYZ()
	local finalizedAngle=CFrame.Angles(targetX, targetY, targetZ)
	return finalizedAngle
end

Inside of the renderstepped replace the code where you set the cframe of the humanoidrootpart with this:
(Replace target with the enemy’s character and rootPart with your own characters humrp)

alignOrientation.Enabled = true
alignOrientation.CFrame = findAngle(rootPart.Position,(Vector3.new(target.HumanoidRootPart.Position.X, rootPart.Position.Y, target.HumanoidRootPart.Position.Z)))

(Idk what your code looks like, so you will have to change some stuff on your own.)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.