#Why is my Trigger not Detecting Collisions?

1 messages · Page 1 of 1 (latest)

iron ridge
#

show code and how your objects are set up if you want people to help you

dense light
#

in geneeral

#

but heres the beatiful code related to the gameobject that mentions collisions

    public void OnTriggerEnter(Collider collider)
    {
        ValidPlacement = false;
        Debug.Log("Enter" + collider);
    }
    public void OnTriggerExit(Collider collider)
    {
        ValidPlacement = true;
        Debug.Log("Exit" + collider);
    }
#

nothing special, if i touch something a bool is on if it doesnt touch that thing then its off and tells me what thing it touched and stopped touching

#

the issue is it works with like 2 things

#

me, the player, bullets, and the enemy spear

#
            Physics.Raycast(RaycastPoint.transform.position, RaycastPoint.transform.forward, out hit, AbilityRange, PlacementMask);
            if (GhostAbilitySpawned)
            {
                ghost.transform.position = hit.point;
            }
``` this is in a different script, the one that is meant for placing the ghost, purely basic code
#
    public void PlaceAbility(int PlaceWhat)
    {
        i = PlaceWhat;
        i += 3;
        if (Abilities[i] > 0)
        {
            if (hit.transform != null && GhostAbilitySpawned == false)
            {
                ghost = Instantiate(PlaceAbilityGhost[PlaceWhat], hit.point, Quaternion.identity);
                GhostAbilitySpawned = true;
            }
        }
    }
#

pretty basic code, since its not much, but its not that, its that my gameobject is just going thru the things which is normal for it to do since its a trigger, but even when i make it into a collider and not a trigger it still phases thru the things, which is also normal as im forcing it to be there cause of the raycasthit BUT it doesnt return anything

#

now i would have said i fucked smth up but it works with certain gameobjects

#

this is what the layer thing looks like of the trigger

#

it ignores the "attack" layer which is good

#

ignore the ugly game, as u can see clearly touching the Test rree, Valid placement is false (the one that checks if it touches the box collider) so it collides with stuff but doesnt return it