Speed boost
#1

I have 2 different methods of speed boosting, and they both do good things, but i'm unsure on how to combine them.

I just put together a function with the 2 methods:
pawn Код:
Boost(vehicleid, speed, method)
{
    switch(method)
    {
        case 0:
        {
            // 1st method
            new
                Float: VelocityX,
                Float: VelocityY,
                Float: VelocityZ
            ;
            GetVehicleVelocity(vehicleid, VelocityX, VelocityY, VelocityZ);
            SetVehicleVelocity(vehicleid, VelocityX * speed, VelocityY * speed, VelocityZ);
        }
        case 1:
        {
            // 2nd method
            new
            Float: Angle,
        Float: AngleX,
        Float: AngleY,
                Float: VelocityX,
                Float: VelocityY,
                Float: VelocityZ
            ;
            GetVehicleVelocity(vehicleid, VelocityX, VelocityY, VelocityZ);
            GetVehicleZAngle(vehicleid, Angle);
            AngleX = floatsin(-Angle, degrees);
            AngleY = floatcos(-Angle, degrees);
            SetVehicleVelocity(vehicleid, AngleX * speed, AngleY * speed, VelocityZ);
        }
    }
}
The 2nd method basically sets the vehicles velocity according to where it's facing.
The good thing about this, is that it doesn't boost the vehicle in the direction that the vehicle is travelling, but the way it's facing.

Say i'm drifting or reversing and use the 1st method, it will make me go sideways or backwards which is annoying.
While this one makes me go forwards, which is what i want.

The problem with this one is that it does not add to the speed, so it doesn't go faster than the speed given.
I would like it to just go faster and faster the more you use the boost, which the 1st method does.

I've tried experimenting a lot, but i'm just lost on how i can combine these 2 good things.
So it somehow multiplies the velocity by the speed given.
And also makes the vehicle go forwards by the angle method.
Reply


Messages In This Thread
Speed boost - by CalvinC - 31.03.2015, 15:01
Re: Speed boost - by Sascha - 31.03.2015, 18:14
Re: Speed boost - by CalvinC - 31.03.2015, 18:32
Re: Speed boost - by Sascha - 31.03.2015, 19:04
Re: Speed boost - by CalvinC - 31.03.2015, 20:18
Re: Speed boost - by Gammix - 01.04.2015, 06:42
Re: Speed boost - by CalvinC - 01.04.2015, 09:33
Re: Speed boost - by BroZeus - 01.04.2015, 09:59
Re: Speed boost - by Sascha - 01.04.2015, 23:50

Forum Jump:


Users browsing this thread: 1 Guest(s)