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.

Vehicle movement in zScript

Postby Cherno » Fri Nov 15, 2019 7:33 am

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
Joined: 06 Dec 2016

Re: Vehicle movement in zScript

Postby CBM » Sat Nov 16, 2019 5:31 am

I would Think you Will need an acceleration curve since acceleration Will only be constant in space
User avatar
Imp Slayer
Joined: 09 Oct 2019
Location: The Shores of Hell
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia with Vulkan support

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests