#custom player collision system

1 messages · Page 1 of 1 (latest)

vale needle
#

i made a custom movement and gravity system but
i cant think of a way to remove the speed of the player on the gravity axis when on ground (the gravity axis/(vector direction of gravity) might change in this game
i tried a ton of different methods but i cant find one that isint jittery or laggy
heres an example video of this gravity system
https://youtu.be/HkgRmVvgDCU
right now im using a part for collision, but i dont like how little customization it offers and how it makes stairs impossible to walk on without invisible slopes

i will paste my current ground handling function and give some more explanations under this cuz the rest would surpass the word limit

#
    if not OnGround.Value then return end
     
    local sped = char.HumanoidRootPart.AssemblyLinearVelocity
    
--acv is a table containing a bunch of charachter related variables
  --gravity3 is the current gravity  vector
       --so by getting the unit of gravity3 we get the direction of gravity
        
     if sped:Dot(-acv.Gravity3.Value.Unit) > 1 then return end --if moving up then returns
    
  --raycasthit variables are constantly updated because they are needed for other scripts,
    -- the raycast is 3 studs from the center of the torso of the character in the direction of gravity
  
    local normal = raycastHitNormal.Value
   
     --acv charheight is the current hieght of the character
  
    local targetPos = raycastHitPosition.Value + normal.Unit * (acv.CharHeight.Value) 
     
    local currentPos = mainColliderPart.Position
    local offset = targetPos - currentPos
      
     char:MoveTo(currentPos + offset) --im using the moveto function of the character model cuz changing the position of hrp or torso breaks everything for whatever reason
   --also i heard this ^ function is faster to run 
      
       -- Here im tryng to negate gravity when on the ground (unsuccesfully)
     char.HumanoidRootPart.AssemblyLinearVelocity = char.HumanoidRootPart.AssemblyLinearVelocity + ((-acv.Gravity3.Value.Unit) * sped:Dot(acv.Gravity3.Value.Unit))
     
     -- print(sped:Dot(acv.Gravity3.Value.Unit))
    --  print(sped.Y)
end```
The problem with this is that when i run it on .Stepped it jitters and when i run it on heartbeat it constantly teleports the player back every frame slowing them down, (with no jittering tho)
also in both scenarios it absolutley despises slopes for whatever reason
shadow totem
vale needle
vale needle
shadow totem
#

well

#

if the ground had more friction than normal

#

itd slow them down

vale needle
#

whats that supposed to fix? also what are you referring to? cuz the script i provided dosent handle any friction logic?

#

are you saying i should make the friction of the collision part im using in my baind aid fix ? but i already mentioned the main problem with that is customization and steps, how would more friction help with any of that?

#

sorry i don't quite get what you mean

shadow totem
#

well what exactly do you want to happen on the ground

#

when they touch it?