1.15.2 Vehicles which you can walk inside

Discussion in 'Spigot Plugin Development' started by Darakandar17, Feb 6, 2020.

  1. I am working on a plugin which creates multi-block (I am using 3D models on armor stands) vehicles. While it is easy to put a seat and just make the player sit, what I want is a vehicle that you can walk inside like the model has collision.

    Setting the velocity for passengers looks easy but how can I make the player-vehicle collision? I tried using invisible shulkers riding armor stands so you can walk on air the problem is though you get glitched collision (https://bugs.mojang.com/browse/MC-156980) is there any way of doing that? Thanks in advance.

    This is what I am trying to achieve. (The first part)
     
    #1 Darakandar17, Feb 6, 2020
    Last edited: Feb 6, 2020
  2. I have spent a significant amount of time trying to get it to work, to the point of reading decompiled client source code to figure out what is going on. The takeaway for you is this:
    • Whenever an entity you are standing on moves up, you WILL clip through, there is no avoiding it
    • The shulker moving down or moving horizontal works fine
    • Using the shulker open animation does allow for very slow upward motion, but even here players risk sliding off. On the client all it does is add the same animation y delta to the entity y position, there are no collision physics involved
    • Players being lifted up, either using levitation or constant velocity boosts, can not move horizontally very well (fly slowness)
    • You cannot boost this movement, because of an inherent problem in packet synchronization. When the server sends a velocity packet to the client, due to server and client running on different clock cycles, the server has no guarantee that that particular packet is actually processed, or that two velocity packets arrived in a single client tick cancelling out the previous.
    • By giving players flight mode temporarily while the vehicle is moving up, and a lot of serverside calculations, you might be able to allow for upwards moving mobility. But players cannot jump without server assistance
    • When shulkers move horizontally, they do not move players on top. You can use velocity boosts to simulate it, but that causes horizontal player input to fail completely because there is a maximum speed players can walk
    Reference: I've been busy trying to implement a Platform attachment for Traincarts so that players can walk inside a train/vehicle as you describe.

    Here's some source code:
    https://github.com/bergerhealer/Tra...tachments/control/CartAttachmentPlatform.java
    https://github.com/bergerhealer/Tra...s/control/CartAttachmentPlatformOriginal.java
     
    #2 TeamBergerhealer, Feb 7, 2020
    Last edited: Feb 7, 2020
    • Informative Informative x 4
  3. Thanks a lot for this informative reply. From what I understand, it looks like Minecraft does not support the idea to work properly.