Help with Boosters

So in Alpaca Raceway, the boosters are weird, so I wanted to fix them. I want it so if the booster is pointing to the left (180 degrees) and the car hits it parallel (90 degrees, the car’s forward direction is down), I want the car to go to the left. pretty simple. But, if the car hits the booster from the other side I want it to also move to the left, but less.
Basically this


Currently, it just makes it get pushed in the X (or Y) direction so you have no control over the car, and it’s not like it’s just speeding up. I want it to be like the boosters in Mario Kart or in Trackmania

2 Likes

Well first off, you’d need to find the momentum with the booster.
You can do this by converting the angle to a radian: a * (Math.PI/180)
Then plugging it into these equations (b being the strength of the boost and a being radian)
x velocity: Math.cos(a)* (b)
y velocity: Math.sin(a)* (b)
Now that you have these, you can extract the player’s velocities and find the mean (average) of the x and y’s.
a being angular x and b being x velocity: (a+b)/2
a being angular y and b being y velocity: (a+b)/2
and that should calculate the boost mixed with the current velocity.

3 Likes

Ok, this should work, but now I have another problem. I had the input for the velocity in the Foward and now I need it to be in the X and Y. I would use the same equation you gave me for the boosters but I needed the X and Y velocity for it, and now I’m trying to figure it out.

1 Like

you should use extractors to get the x and y velocity, it should output the correct x and y. You should be able to keep the forwards

1 Like