• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Need help with Realistic Vehicle Movement

Status
Not open for further replies.
Level 13
Joined
Oct 31, 2017
Messages
128
I'm trying to make a HALO-themed RTS as a little side project of mine, and I want my vehicles to move smoothly. Like when they turn and move, they have to curve around a bit instead of instantly turning. It would be great if it was in GUI-form and used Hashtables, but custom values work too.

Much appreciated if some help was given.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Fundamentally one has to use SetUnitX/Y as those do not stop the unit from moving so the normal path finder will still work.

One might want to track the move target with the system so that one can prevent degenerate orbiting around a point, if that turns out to be a problem.

Be aware that what you want could get demanding fast. It should be fine for 10-20 vehicles but not 100-200.
 
Level 13
Joined
Oct 31, 2017
Messages
128
I understand about using the SetUnit script to avoid cancelling movement and that it would really be demanding so I'm prepared to face the consequences. I just don't get how I can make it detect when to stop and which angle to orbit around.

I could probably setup something that makes it detect whether or not the vehicle has orbited and is facing the target point, that wouldn't be too hard.

But how exactly would I make it find the right angle to move around. Like if I told the vehicle to move left, how would I make it curve left instead of right all the time? I apologize if I'm being confusing. I understand the basics of JASS, but I find GUI to be much more easier to use despite how inefficient it can be. So I'd appreciate it if the solution could be solved with the World Editor's GUI triggers.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Like if I told the vehicle to move left, how would I make it curve left instead of right all the time?
You cannot alter the units rotation as that would implicitly cancel all movement orders. If one did that then there would be no path finding to help navigate the unit around which poses a major usability problem.

Instead I would recommend tracking the velocity of the cars. The cars have a limited rate of acceleration and as such if they try to turn fast they will skid around to some extent. Not perfect car physics but better than nothing. One accelerates the car in the direction it is facing and the path finder will always point it where it has to go to reach the destination. One can detect when the destination is reached by tracking the movement orders or possibly checking if the unit did not move since the last tick (is stopped).
 
Level 13
Joined
Oct 31, 2017
Messages
128
One can detect when the destination is reached by tracking the movement orders or possibly checking if the unit did not move since the last tick (is stopped).

Checking the movement orders of the unit to see if they stopped? Why didn't I think of that surprisingly simple answer? I'll have to start the system from scratch due to some incompatibility issues with the solutions you gave, but it'll all be hopefully worth it. Thanks mate!
 
Level 4
Joined
Jan 17, 2018
Messages
112
I'm a noob, but a quick thing I'm thinking of. Can't you spawn pathing blockers temporarily for the unit making a path for it to move?
 
Status
Not open for further replies.
Top