playMaker

Author Topic: Puzzle Help  (Read 1436 times)

jrush64

  • Playmaker Newbie
  • *
  • Posts: 20
Puzzle Help
« on: March 01, 2019, 10:47:15 PM »
I'm trying to create a system like in this shrine from Breath of the Wild.

https://www.youtube.com/watch?v=lv1XJ-oHXjg

I want to have a central power supply and then you use barrels to pass electricity through what looks like pipes. In the video above you can use a large metal box or the barrels to pass the electricity through the pipes in the floor.

I've been trying to do this all week but have had no luck getting it to work properly.

I used triggers and bools but it never worked properly.

Can anyone please help?

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Puzzle Help
« Reply #1 on: March 03, 2019, 09:39:13 AM »
Triggers or colliders and bools seems like the way to go. You need to provide some information what exactly doesn’t work.

As I see it, you need three elements for a simple prototype, like three cubes. Use a clean scene, and worry about the looks later. You need to add colliders and then use either On Collision or On Trigger global events, to detect whether they collide or touch. You can also use a state with appropriate actions that listen. You need to make sure to use the correct versions. When you tick the trigger checkbox on the colliders, you need to use trigger actions. You also need to use the correct pair, there’s a default set for 3d, and another one for 2D. Can you make triggers or colliders work?

You want to use the On Trigger/Collider Enter and On Trigger/Collider Stay. I’d use the global system events. I.e. when they collide, or are still intersecting, the state is active,

Next, you could use a bool or tags to indicate whether that cube has power. When you collide, check wether the connecting cube has power, and if so, also set power to true, if not, set to false. Only the conductor box always has power.

Break down your process and pinpoint what exactly doesn’t work.
« Last Edit: March 03, 2019, 09:40:44 AM by Thore »

jrush64

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Puzzle Help
« Reply #2 on: March 04, 2019, 08:27:16 AM »




Thanks for responding.

This is what im trying to do. AS you see in the image when the clock is near the wires i want it to conduct electricity.

I've gotten it to work up to a point i can detect triggers when a conductor is connected to a wire.


What I did before was use tags. The wires have their own tags and if the collide with a conductor which has it's own tag, the wires will light up. THe issue is telling if I turn off the power base Or I remove a previous conductor.

Let's say I have wires 1,2,3,4. Wire 1 is connected to the power base, and wire 2 and 3 are connected to a conductor. If I turn off the power base connected to wire 1, I want wire 2 and 3 to turn off. However the Issue IS I can't get wire 2 and 3 to turn off when I turn off the power base.

The issue is I cant get everything to turn off the moment the power base is turned off.




That youtube video is exactly how I need it to work.

« Last Edit: March 04, 2019, 08:29:21 AM by jrush64 »

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Puzzle Help
« Reply #3 on: March 04, 2019, 08:48:37 AM »
One way would be to check continually whether the connection is still established (“am I touching an object that is powered”). Use Every Frame for the prototype, which you may want to optimize later. Another, probably better, way would be to add a “update” global event. When the power is tampered with, it will broadcast refresh and all subsequent objects should update.

jrush64

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Puzzle Help
« Reply #4 on: March 04, 2019, 08:54:17 AM »
OK, I tried that before and it almost worked.

An example, I have 5 wires. Wire 1 and 2 are turned on including the power base. however If i place a conductor near wire 5, It also turns on even with wire 3 and 4 turned off.

GonerGames

  • Junior Playmaker
  • **
  • Posts: 53
Re: Puzzle Help
« Reply #5 on: March 04, 2019, 11:54:12 AM »
Try this. It is based on the wires and nodes not being rotated

Main Power Source - Tag "PowerON" - Box Collider - Trigger On - Rigidbody

**Wires and Nodes can function the same using the below**

Wire/Node - Tag "Untagged" - Box Collider - Trigger On - Rigidbody
        - Move/scale box collider to one end - ie. input side
        - Create Empty Child object - Box Collider - Trigger On
        - Move/scale box collider to opposite end - ie. output side

FSM on Wire:
         State 1 - Trigger event **Check for inital trigger**
                           - Use Owner - OnTriggerEnter
                           - Collide tag - PowerOn
                           - Send Event - Turnon
                           - Store Collider - PoweredObj

                      - Trigger event **check for still colliding/Incase power is cut and restored upstream of this connection**
                           - Use Owner - OnTriggerStay
                           - Collide tag - PowerOn
                           - Send Event - Turnon
                           - Store Collider - PoweredObj

         State 2 - Set Material - Index 0 - Material of choice **this is where you visually show the wire is active**
                    - Set Tag - Owner - "PowerOn"
                    - Set Tag - Specifiy Object - Child Obeject Ouput - "PowerOn"
                    - Use FINISHED as auto forward to next state

          State 3 - Game Object Compare Tag **See if what we are colliding with changes tags, useful if power gets cut up stream**
                            - GameObject = PoweredObj
                            - Tag = "PowerOn"
                            - False Event - TurnOff
                            - Every Frame - On
                      Trigger Event - On Trigger Exit **if we manually move this away from power**
                             - Collide Tag = "PowerOn"
                             - Send Event - TurnOff

         State 4 - Set Material - Index 0 - Material of choice **this is where you visually show the wire is inactive**
                    - Set Tag - Owner - "Untagged"
                    - Set Tag - Specifiy Object - Child Obeject Ouput - "Untagged"
                    - Use a Wait of .2 or .3 - FINISHED
« Last Edit: March 04, 2019, 12:05:58 PM by GonerGames »