Multi z-level vehicles exist
Describe the bug
So while messing with debug I saw an open sewer and figured I'd drive over it knowing non straight ramps are buggy and lost half my vehicle which while weird seemed fair enough.
Then I checked the level below to see the wreck it had left in the sewer... except instead it was still directly next to my vehicle, driving along with me despite being in solid ground
Attach save file
Steps to reproduce
Drive over an open sewer diagonally shearing your vehicle Keep driving Check the level below with clairvoyance and discover the rest of your vehicle still thinks it's attached
Expected behavior
Idk not this
Screenshots
No response
Versions and configuration
- OS: Windows
- OS Version: 10.0.19045.3324 (22H2)
- Game Version: 24b09f4 [64-bit]
- Graphics Version: Tiles
- Game Language: System language []
- Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Portal Storms Ignore NPCs [personal_portal_storms], Slowdown Fungal Growth [no_fungal_growth], No Rail Stations [No_Rail_Stations] ]
Additional context
No response
If you examine the vehicle it still shows the whole thing as being one btw
It has the collision of the half left above ground though
The bottom half has no collision at all as far as I can tell
You can also fix it by driving across the ramps in a similar way which makes it as though nothing happened
I think "multi-z-level" would work better than multitile here? Almost all vehicles are multitile, I think what you're working with here is multi-z-level
I think "multi-z-level" would work better than multitile here? Almost all vehicles are multitile, I think what you're working with here is multi-z-level
🤦
Yeah, I am pretty sure while vehicles are 1 tile high, vehicle parts can be positioned on different z-levels.
Is that possible to get like a two-levels bus in the future?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.
/confirm
Possible "what should happen": Have center of mass needing to be within the ramp support:
Vehicle V with center of mass C going this way -> over Ramps R
VVVV R
VVCV
VVVV R
In this picture, the Center of mass will pass in between or over a ramp R. Since vehicles cannot turn on ramps, calculate it by projecting where the vehicle would go, if it went in a straight line. In case that does not happen, the vehicle would "tip over".
Tipping over sounds complicated, so let's just stop the player from being able to do that. By crashing into the ramp(s) (colliding with them).
This doesn't consider wheel position. That said, vehicles need only one tile under them to not fall and can drive over tips of trees when placed there [cannot find the bug report].
In case there are enough ramps for support, draw a line between the ramps, that is your imaginary ramp the vehicle should rise on.
A problem is that you need to detect disconnected ramps and treat them all in this algorithm at once. Otherwise, the vehicle would want to "tip over" both ways and collide with both ramps.
Solving that: We can do convex hull over the ramps https://en.m.wikipedia.org/wiki/Convex_hull . But we need the lenghts in this hull to be at most as big as the vehicle is wide. I don't know the simple way to solve this yet.
Another solution I considered: Check all vehicle tiles in the front. If some are on the ramp and some not, treat it as colliding with the ramp instead of driving on it.
What happens IRL when vehicle goes onto a ramp partially: https://youtu.be/nvlU5c0D87s?t=10
Flip over from the same vid: https://youtu.be/nvlU5c0D87s?t=114