As you are aware the current bellyslide fires you in a straight line and turning your view with the mouse does not make you turn.
I want to add the ability for the Gorge to 'PowerSlide' around corners. I have an idea of the kind of code that needs to be written, but I haven't really delved into the mathematics for many years, so I am asking for help in what I need to do. I will use this as my re-introduction to advanced maths :)
So here is what I want the code to do in principle:
if self:GetIsSliding() then
local currentDirection = GetNormalizedVector(self:GetVelocity()) local viewDirection = GetNormalizedVector(self:GetViewCoords()) if viewDirection ~= currentDirection then if difference between viewDirection and currentDirection > 5 degrees then local newDirection = (Difference between viewDirection and currentDirection) \ 2 local slidePush = newDirection * (kStartSlideForce \ 2)
velocity.x = velocity.x + slidePush.x velocity.y = velocity.y + slidePush.y velocity.z = velocity.z + slidePush.z end end end
The aim of this is to take the difference between the direction you are facing, and the direction you are going, divide the angle. and start propelling you along the divided angle with a minor slide kick, to power you around the corner slowly. Values will definitely need adjusting, but this is what I want to do in principle, any help with the implementation?