Hi devforum!
I’m making a parkour game similar to Mirrors Edge or Parkour, and I’ve implemented a custom controller for the character. I’ve implemented vaulting but I realized that vaulting is more jittery than it is supposed to be, and I figured out that it was because of a wall collision.
Here’s the relevant parts of my code:
--FROM THE CONTROLLER
function Controller:vault(raycastResult: RaycastResult) --> Make sure to add ledge grab / mantle later !
local positionDifference = raycastResult.Position - self.rootPart.Position
self.canMove = false
self.animateDisabled = true
print('Vault')
self.animations.vault:Play(0.1)
self.velocity = self.velocity * Vector3.new(1, 0, 1) + (positionDifference.Unit + Vector3.new(0, 1.2, 0)) * 20
--> self.velocity is just me assigning assembly root vel every frame btw
task.delay(self.animations.vault.Length * 0.3, function()
self.canMove = true
self.animateDisabled = false
end)
end
Please help!!! HOW CAN I GET RID OF JITTER FROM WALL COLLISIONS???
5 Likes
have you ensured the Vault print isnt firing several times
if it is, then theres the jitter
if it isnt, try using a mover constraint rather than setting velocity
1 Like
its not the vaulting, it only prints once
do you think that i can just put a shapecast in front of the character and stop velocity from there? because i’m gonna have to shapecast/raycast anyways for a wallclimb movement i’ll be adding
1 Like
I’d use a shapecast to find a vaultable object and then a BasePart:FindClosestPointOnPart() to find the actual reference point, and if thats below the hip-line then push the player up above that point
i still suggest a mover constraint though rather than raw velocity
2 Likes
idk what i was on but i think i was sleep deprived or something lol when i wrote that
by stop velocity i meant that i was doing a custom movement velocity that i add to the total velocity
and i meant that i could just stop that velocity if it detected that there was a thing in the direction of where the velocity was going via a blockcast/shapecast
-- on ground: counter gravity exactly
self.accelerations.normal = Vector3.new(0, -self.accelerations.gravity.Y, 0)
if self.canMove then
-- movement acceleration based on input direction
self.accelerations.movement = self.humanoid.MoveDirection * (self.walkSpeed + self.currentMomentum)
else
-- movement acceleration based on input direction
self.accelerations.movement = Vector3.zero
end
-- friction opposes horizontal velocity
local horizVel = Vector3.new(self.velocity.X, 0, self.velocity.Z)
self.accelerations.friction = -horizVel * self.friction
-- cancel vertical velocity to prevent jitter
if self.velocity.Y < 0 then
self.velocity = Vector3.new(self.velocity.X, 0, self.velocity.Z)
end
if you’re wondering why i separated velocities into ‘accelerations’, its for organization and also to fix a ‘problem’ that i thought there was, but in reality was never there (this code is one of the first things i wrote in this project btw, so if it looks bad, thats why)
I’ve used a linear velocity constraint instead of manually setting assembly linear velocity but it pretty much acts the same. I’m pretty the issue is the velocity has nowhere to go when against a wall and isn’t slowed down since I’m setting it each frame. I think I can fix this by doing the shapecast that I talked about earlier. 
I also think that the jitter from the vault is the character colliding with the edge of the wall since my direction only goes from the root part to the raycast hit position, but IDK how to remove this. 
If anyone knows, please let me know!