Tweening variable for force angle and rotating is weird

The problem

I implemented a drift feature for my game.
It works fine for the player but doesn’t work properly for the bot.
The bot moves backwards. It usually occurs when facing right. Not always.

The drift works by using a tween to tween, a variable used for angle of force.
Tween is from current value to current bot angle

GIF, Showcasing of the problem

Screencastfrom2024-12-2514-17-22-ezgif.com-optimize

Detailed snippet of the events

I collapsed events of which I think are unrelated.
I also made a comment above some events to explain their purpose and how they work
If you want to see other events or know the purpose of something, ask me here.


Want a zipped version of this game?

I don’t think anyone cares to load the project, and that’s fine.
If you want to try the bug by yourself, ask me here and ill share a playable version/zipped version of this game.

Looks like it’s an angle problem…


See this GIF:

Screencastfrom2024-12-2623-52-17-ezgif.com-optimize


I think these events are the cause:

Using lerpAngle works, Is this a problem with tweening?

Please help.
What is the alternative for lerpAngle but for tweening?

Also:

Tweens should be actioned once and let to run. You’re repeatedly starting a new tween. I’d suggest adding a condition to check the tween isn’t running before actioning the tween.

1 Like

I changed it.
Here is how:

This was the result:

Bot doing a 360, flexing its abilities.

It didn’t work

The main issue of the bot going backwards has gone, but now it does a 360 (drift angle/ force angle) and the drift is terrible and delayed.

This might not be a good fix

I have implemented the same drift system for the player, and it works completely fine.

Player events


Notice how there is no condition to prevent multiple ‘tweens’ of angle


This might not be the best implementation for drift. I am open to suggestions.

Not sure why it works for player but not AI. It may be there are other events interfering that haven’t been screen snipped.

However, if lerpAngle works, why not just stick with that?

1 Like

First, it doesn’t give satisfactory results.
Two, I’ll need to adapt to lerpAngle

What I think the problem is that Tween isn’t optimized for angle instead it just thinks that this is a number variable because I literally just Tween a number variable and so it isn’t treated as an angle

Maybe because the AI has more of ‘robotic’ movement

Should I consider to?
They are very long.

You could, but I don’t have the time at present to delve in other’s issues, though others might.

You could isolate the feature by creating a small project just with that AI drift control and see if you can make that work, and then move that into the main game.