-
Notifications
You must be signed in to change notification settings - Fork 20
Player Collisions
Player collisions in FM+USE allow for walking into, standing on top of, and even "riding" on top of vehicles.
There are two ways to specify what the player should collide with.
These features may work in any version of FM+, but certainly FM+1.0.5 and onwards, afaik.
This requires FancyCollision false
, its default value.
By far the simplest and easiest system to implement is where the vehicle's hitboxes are used as collision boxes. (E.g., you can walk into the side of them, walk over the top of them e.t.c.).
The only modification to your config that is required, is to specify where it should test for collision. The default is nowhere.
The way to do this, is with a harvester box. Note: This is NOT set using the standard harvester hitbox (it's a duplicate system, aimed at making hitboxes covering the entire vehicle for use with breaking blocks n such). To set this particular hitbox, you need to use the config line:
HarvestBox [sizeX,sizeY,sizeZ] [posX,posY,posZ]
All in TB pixels (16 pixels = 1 block).
For example:
HarvestBox [80,80,60] [-40,-10,-30]
If you want to further use this harvester box, see the config reference here.
This requires FancyCollision true
, its default value.
This system is a bit more tricky to use, but is a lot more powerful. To specify what players should collide with, you create glorified shapeboxes. You still need the harvestbox code from the previous system to specify where to look for collisions.
To add a hitbox, you can use one of the following:
AddCollisionMesh [posX,posY,posZ] [sizeX,sizeY,sizeZ] [p1X,p1Y,p1Z] .. [p8X,p8Y,p8Z]
e.g.
AddCollisionMesh [0, 0, 0] [20, 50, 5] [0, -1, 0] [0, 0, 0] [0, 0, 0] [0, 0, 0] [0, -1, 0] [0, 0, 0] [0, 0, 0] [0, 0, 0]
AddCollisionMeshRaw posX posY posZ sizeX sizeY sizeZ p1X p1Y p1Z .. p8X p8Y p8Z
is the same, just with all the values in a long line.
For the turret, use AddTurretCollisionMesh
and AddTurretCollisionMeshRaw
.
The units here are also pixels, (16px = 1 block).
The player will collide with all six sides of this shapebox (IF they are in the harvester hitbox). In FM+USE, you can see the corners of these shapeboxes in debug mod, as particles.