1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Ride into the sunset with the 32nd Modeling Contest. The contest is optionally paired. Best of luck, people!
    Dismiss Notice
  4. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  5. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Need help with Realistic Vehicle Movement

Discussion in 'World Editor Help Zone' started by SgtWinter, Mar 16, 2018.

  1. SgtWinter

    SgtWinter

    Joined:
    Oct 31, 2017
    Messages:
    72
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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.
     
  2. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,930
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  3. SgtWinter

    SgtWinter

    Joined:
    Oct 31, 2017
    Messages:
    72
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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.
     
  4. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,930
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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).
     
  5. SgtWinter

    SgtWinter

    Joined:
    Oct 31, 2017
    Messages:
    72
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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!
     
  6. Marcell

    Marcell

    Joined:
    Jan 17, 2018
    Messages:
    112
    Resources:
    0
    Resources:
    0
    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?
     
  7. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,746
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    Bad idea. That will impact other units.
     
  8. Marcell

    Marcell

    Joined:
    Jan 17, 2018
    Messages:
    112
    Resources:
    0
    Resources:
    0
    I'm thinking spawning it for like a split second so that the unit can register the path to move, but ok, I learned something new
     
  9. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    It would still mess with everything that is nearby.