character tilt system not working properly, a little help?
Asked by
4 years ago Edited 4 years ago
i was working on making a tilt system for the player that tilted them in the direction they were turning in, like this gif:
https://gyazo.com/e599a9630dbb759e85ee3b6b3442bc40
but I ran into a problem, the character doesn't tilt or show any signs of tilting at all. I was trying to make the tilt a little bit noticeable, but not too heavy as I personally don't like tilt systems like that. Here is the code I have below.
02 | local origin = root.RootJoint.C 0 |
05 | local function character_tilt() |
06 | local function lerp(a, b, t) |
07 | return a + (b - a) * t |
10 | vel = root.Velocity * Vector 3. new( 1 , 0 , 1 ) |
11 | if vel.Magnitude > 2 and vel.Magnitude < 15 then |
13 | angle = root.CFrame.RightVector:Dot(dir)/ 2 |
18 | local results = lerp(roll, angle, 0.1 ) |
19 | root.RootJoint.Transform = root.RootJoint.Transform * CFrame.Angles( 0 , roll, 0 ) |