Skip to content

AddLocalEntityInteraction does not support specifying a bone on a vehicle #38

@gamenew09

Description

@gamenew09

As the title states, the AddLocalEntityInteraction export doesn't take into account the bone. In the code itself it seems like there isn't a mention in the export for the bone argument, so this probably applies to all local entity interactions.


Expected behavior:

  • When using AddLocalEntityInteraction it should create the interaction point on the vehicle on the correct bone.

Actual behavior:

  • Doesn't show an interaction point at all on the specified bone.

Recreation:

  1. Create a resource with the following client lua file:
local interact = exports.interact

local offset = vector3(0,0,0)
local bone = 'boot'

local useEntityInteraction = true

---@param entity integer
local function createInteractions(entity)
    if useEntityInteraction then
        print(("Creating interaction with %i via AddEntityInteraction"):format(entity))
        local netId = NetworkGetNetworkIdFromEntity(entity)
        -- Below always shows up as long as entity is valid.
        interact:AddEntityInteraction({
            netId = netId,
            name = 'ent_interaction',
            id = 'ent_interaction',
            distance = 8.0,
            interactDst = 1.0,
            ignoreLos = true,
            offset = offset,
            bone = bone,
            options = {
                {
                    label = "Chop Trunk (Networked Entity)",
                    action = function (entity, coords, args)
                        print("chop chop")
                    end
                }
            }
        })
    else
        print(("Creating interaction with %i via AddLocalEntityInteraction"):format(entity))
        -- Below doesn't show up at all.
        interact:AddLocalEntityInteraction({
            entity = entity,
            name = 'localent_interaction',
            id = 'localent_interaction',
            distance = 8.0,
            interactDst = 1.0,
            ignoreLos = true,
            offset = offset,
            bone = bone,
            options = {
                {
                    label = "Chop Trunk (Local Entity)",
                    action = function (entity, coords, args)
                        print("chop chop")
                    end
                }
            }
        })
    end
end

CreateThread(function ()
    local playerPed = PlayerPedId()
    local vehicle = GetVehiclePedIsIn(playerPed, false)

    if DoesEntityExist(vehicle) then
        createInteractions(vehicle)
    end
end)
  1. Spawn a vehicle that has the boot bone.
  2. Sit in the vehicle and run the resource with the useEntityInteraction boolean set to true. This will create an interaction point on the current vehicle that shows when you get out of the vehicle.
  3. While sitting in the vehicle still, run the resource with the useEntityInteraction boolean set to false. This does create an interaction point (no error while creating) but doesn't seem to actually show at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions