Vehicle movement in zScript

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Vehicle movement in zScript

Post by Cherno »

Having done a quick search, it seems like most drivable vehicle code is outdated or no longer available, so I'm asking if anyone has any ideas for such movement behavior?
A normal actor, when having it's forward velocity affected by Thrust() or A_ChangeVelocity(), reaches top speed very quickly. A vehicle, by contrast, should slowly accelerate until hitting maximum velocity. The issue here is that the maximum velocity is directly based on the thrust velocity added each tick when accelerating.

Desired behavior:
acceleration = 0.5
maximum velocity (top speed) = 20

So when 0.05 is added to the actor's forward velocity each tick when accelerating, it takes ~40 ticks to rach maximum velocity (things like friction notwithstanding).

Is there a way to have this more gradual acceleration while retaining a relatively high maxmimum velocity?
User avatar
CBM
Posts: 373
Joined: Wed Oct 09, 2019 3:39 am
Graphics Processor: nVidia with Vulkan support
Location: The Shores of Hell

Re: Vehicle movement in zScript

Post by CBM »

I would Think you Will need an acceleration curve since acceleration Will only be constant in space
Post Reply

Return to “Scripting”