Skip to content

Review the collisionMask passed to rayCastClosest(..) #35

@gavanderhoorn

Description

@gavanderhoorn

The current collision mask is set to:

FS19_modROS/modROS.lua

Lines 92 to 98 in 5e8d484

-- set a raycast mask for a camera node which enables bits 5(unkown), 6(tractors), 7(combines), 8(trailers), 12(dynamic_objects)
local RC_MASK_UNKNOWN5 = math.pow(2, 5)
local RC_MASK_TRACTORS = math.pow(2, 6)
local RC_MASK_COMBINES = math.pow(2, 7)
local RC_MASK_TRAILERS = math.pow(2, 8)
local RC_MASK_DYN_OBJS = math.pow(2, 12)
self.raycastMask = RC_MASK_UNKNOWN5 + RC_MASK_TRACTORS + RC_MASK_COMBINES + RC_MASK_TRAILERS + RC_MASK_DYN_OBJS

IIRC, we've not been able to really find any documentation for those bit positions, except in this article/tutorial: How to Set Correct Collisions in Your Farming Simulator Mod:

Bit Feature
1 non_pushable1
2 non_pushable2
3 static_world1
4 static_world2
6 tractors
7 combines
8 trailers
12 dynamic_objects
13 dynamic_objects_machines
20 trigger_player
21 trigger_tractors
22 trigger_combines
23 trigger_fillables
24 trigger_dynamic_objects
25 trigger_trafficVehicles
26 trigger_cutters
30 kinematic_objects_without_collision

I suspect these are documented somewhere, I just haven't searched for it.

Whether the current value of the collisionMask is the optimal value for our purposes would be something to discuss.


Edit: from the same page: some example collision masks for various objects/vehicles:

Collision Type Bits Hex Value Decimal Value
Tractor 1, 6, 13, 21 0x202042 2105410
Combine 1, 7, 13, 22 0x402082 4202626
Fillable 1, 8, 13, 23 0x802102 8397058
Cutter 1, 12, 13, 24, 26 0x5003002 83898370
Tools 1, 13 0x2002 8194

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedluaIssues requiring changes/fixes to the Lua codenice-to-haveA nice feature, but not a priority right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions