Hi there!
I am soooo confused on how to get to objects to interact with a trigger. Basically what I have is a spaceship that moves from marker to marker by clicking a set of on-screen arrow keys:
I want players to visit each planet while avoiding the fireball (sort of PacMan style), with an action list that is initiated on a collision with either a planet (yay!) or the fireball (boo!). Experimenting first with the fireball, I have tried making the ship an NPC (using the character wizard), attaching a rigidbody 2D component and a circle collider, then adding a slightly-larger-than-the-object polygon collider and a trigger component to the fireball. The ship doesn't require any animation or change to the way it faces, and I was planning to just create a simple animation to move the fireball around a set "path;" the planets will all be stationary.
Is there a way to do this without any scripting? And if so, can you please explain it to me in very basic terms? If not, please feel free to advise me that this is way outside of my ability level!
THANK YOU!
Ann
AC v1.80.5
Unity 2023.2.08.3202.5344
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
It's not exactly the mechanics that AC is intended for, but it may be possible with some tricky use of the Object: Transform and Physics: Raycast Actions.
As with your sliding box puzzle, attach a Moveable component to the ship (remove the NPC etc components for now), and then use the Object: Transform Action to move it up/down/left or right when an arrow icon is clicked. For now, we just want to get the ship moving in the right direction.
You may want to resize the background so that each cell is 1 unit apart, to make the calculations/positions easier to deal with.
Next will be to limit movement to just the black areas. Start by attaching 2D Colliders to the walls.
Then, add 5 empty GameObjects as children to the Ship - one in the centre, then the others left/right/up/down by 1 unit from ths centre (i.e. the positions the ship will move to next).
Then, for each "Move" ActionList, precede the Object: Transform Action with a Physics: Raycast Action. Set the Origin set to the centre child, Direction mode to To Set Destination, and then set Destination to the corresponding empty in the intended direction. Configure the Layermask to have it detect the wall Colliders (you may want to use a dedicated Layer for this), and then have the Object: Transform Action run via its If not object detected output.
Thanks for this!
Sorry I didn't clarify better... by making use of tilemaps to standardize the "grid" /cell size, I was able to get the ship to navigate the maze successfully; it's the collision part that I'm struggling with. How do I get something (a sound, etc) to happen when the ship and the fireball collide?
Attach a Trigger component to the Fireball, and configure it to detect the Ship.
You can avoid the use of Rigidbodies by setting the Trigger's Detection method to Transform Position. Increase the # objects to detect field by 1, and then add the ship to the object list beneath - the Trigger will then fire when the ship's origin comes into contact with the Trigger's collider.
I cannot seem to get this this to work no matter what I try! I've watched the tutorial videos, read through the manual, and explored other forum posts, but I'm clearly missing something.
I've added a trigger (from the scene menu) to the scene and made it a child of the fireball. The components are configured like so (on the right) - I've also included the ship's collider details on the left:

The interaction itself only has one element in its action list right now - a dialogue box that just brings up "boooooooom" as a subtitle for testing. Do I need to put something else in that action list? Is there something ticked that shouldn't be (or vice versa)?
Is the Trigger's collider positioned in the centre of the fireball, and is the Ship's position in its own centre?
Does the Player move through gameplay-blocking ActionLists? If so, you'd need to adjust the "Reacts" field to have it react during cutscenes.