Forum rules - please read before posting.

Trigger 2d not response

Hi fellows,

Trigger 2d not responsive to player or any objects. Tried in multiple projects and scenes, not working. Googled and don't see much of this issue and thinking this might be me missing something. Please see attached for player and trigger setting.

image

image
Cheers,
Joe

Comments

  • The image isn't showing - you can't host images here, only link to them.

    The Trigger2D objects rely on Unity's physics system, so the standard requirements still apply: in order for a 2D Trigger to detect an object, the object must have a Rigidbody2D on it.  Add this component to your player and it should work.
  • Yep I found it after double compared my player with your Brain's component in 2d demo!

    Many thanks for your help Chris!
  • One more question. How can I edit, or delete this post? Since the problem was resolved I planned to add a resolve just before headline, or delete it if you prefer.
  • You can't after a set time, but don't worry about it.
  • Hi guys,

    I have a similar problem currently, I believe it happened shortly after updating to AC 1.45. I have two sprite-based player characters, each of which has a Rigidbody 2D attached, however the trigger doesn't seem to recognise either of them. I've tried playing around with the trigger settings but to no avail. Here's an image of the trigger set up:


    The character is set up as follows:
    Object:
    - Paths script
    - Player Script
    - Rigidbody 2D

    Sprite Child:
    - Sprite Renderer
    - Animator
    - Follow Sorting Map (Script)
    - Capsule Collider

    Sound object:
    - Audio Source

    Does the Rigidbody2D need to be on the same element as the capsule collider? I've tried putting them both on the same object but Unity keeps telling me that there's a conflict. Any ideas?

    Best,

    DB
  • Hi @DashBounder.

    Going by your screenshot, it seems you're working in "Top Down" 2D mode.  Is this the case?

    Unless you're too far into your project, I would recommend switching to "Unity 2D" mode instead, as Top Down requires you to use 3D Rigidbodies / Colliders instead of 2D ones, and "Unity 2D" is the default 2D mode.  This is changed in the "Moving and turning" option in your Settings Manager.

    If you remain in Top Down mode, you'll have to swap out your Rigidbody2D for a regular Rigidbody.  Top Down mode works in the X/Z plane, so a Rigidbody2D has no effect here (it only works in X/Y).
  • Hi @ChrisIceBox

    Ah I see! Yes that's the case, I chose Top Down (ages ago) because I thought it'd be good to have more choice over the pathfinding method, but it doesn't seem like much of an advantage.

    Am I correct in thinking that if I switch over, I'll need to flip the geometry, re-do the nav meshes and that's about it? If so that won't be too much of a big job and I'm keen to make the game run as optimally as possible.

    Cheers!

    DB


  • I would definitely recommend switching over if you can - perhaps backup, do one scene, and see how it goes for you.  Geometry will need to be flipped, NavMeshes rebuilt, but also any colliders will need to be replaced with a 2D counterpart - so your Hotspots will need to be remade.

    When you switch to Unity 2D mode, the Hotspot, Trigger etc prefabs in the Scene Manager become their 2D counterparts, but if you want to replace your existing logic prefabs with 2D ones, it'd probably be quicker to manually remove their Box Colliders and add Box Collider 2Ds.  Just don't hit that "Apply" prefab button at the top!
  • Hi Chris,

    I managed to get it to work, it was actually pretty straightforward, thanks for the advice!

    Cheers!

    DB
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.