Jump to content

Recommended Posts

I have a child entity prefab that I want to always take priority for mouseovers from its parent entity prefab.
I am having a difficult time enforcing this, as the parent entity seems to take priority for mouseovers.

I have tried:

  1. SetSortOrder,
  2. SetFinalOffset
  3. SetRayTestOnBB

Its a very simple child prefab attached to a parent prefab, if there is any suggestions. Think of this child entity like a button attached to another object.

Edit:
Thank you @CarlZalph for his solution this did the trick for me.
 

local Mouser = function(entity)
    local ents = GLOBAL.TheInput.entitiesundermouse
    local entc = #ents
    for i=2, entc
    do
        local ent = ents[i]
        if ent and ent.prefab == "somechild"
        then
            return true
        end
    end
    return false
end

Parent:
inst.CanMouseThrough = Mouser

 

Edited by IronHunter
  • Like 1

Solution came to me after reading over input.lua's OnUpdate function seeing how it was handling the entities under the mouse.

Idea was to make it so that the 'parent' will let itself go transparent to the mouse so long as the target child entity is also under the mouse thereby forcing the child to take highest priority over the parent when mouse hovering.

  • Like 1
  • Thanks 1
  • Sanity 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...