How to enable a player to wire up solar system components( I tried to use line renderer)

Subject:

Need advice: Implementing VR wiring mechanic for Meta Quest 3 (with flowing current visuals)

Body:

Hi everyone,

I am building a simple 3D educational experience for the Meta Quest 3 where users assemble a standalone solar power system inside a rugged house.

The setup includes:

  • Ground solar panel
  • Charge controller
  • Two batteries
  • Inverter
  • Load box

The goal:
The player needs to place these components and wire them together. Once wired correctly, I want to show current flow using small, glowing spheres traveling along the length of the cables.

Where I am stuck:
I am struggling with the wiring mechanic itself. I tried creating small cylinder prefabs with a communication script attached to them to act as the plugs for the wires, but it is not working at all. The idea is that at that step, the user grabs the plug at the terminal of one object and then moves till he reaches the terminal of the next component, then the line that has been generated as he was moving snaps on the terminal he is connecting to.

What is the best workflow or architectural approach in Unity to achieve this? Specifically:

  1. How should I handle the VR interaction for drawing or connecting a wire from Port A to Port B using XR Interaction Toolkit (XRI) or Meta XR SDK?
  2. What is the most efficient way to render the physical wire dynamically between two points (e.g., Line Renderer, splines, procedural meshes)?
  3. How can I easily animate the “glowing spheres” along that dynamic path to represent current?

Any code snippets, package recommendations (like Unity Splines), or architectural advice would be greatly appreciated!

Thanks in advance!

Start with a UX design: if you can’t imagine one, find one already out there (like the VR painting apps) and derive yours from it. You need a plan detailing what happens when controls are inputted and what visual feedback you want to give the user.

Give 'em a try. Guessing performance isn’t a thing. Guessing performance about something not even written yet is even LESS of a non-thing. Don’t waste your brain there.

Tweening libraries.

Get busy now. What you contemplate is going to have a LOT of UX engineering that you will have to figure out for yourself, not anything someone can just tell you.

I like this guy’s step-at-a-time approach:

Imphenzia: How Did I Learn To Make Games:

Two steps to tutorials and / or example code:

  1. do them perfectly, to the letter (zero typos, including punctuation and capitalization)
  2. stop and understand each step to understand what is going on.

If you go past anything that you don’t understand, then you’re just mimicking what you saw without actually learning, essentially wasting your own time. It’s only two steps. Don’t skip either step.

Step #2 is particularly critical when learning.

If you are unwilling or unable to do Step #2, just ask someone else to do the whole game for you.

Hey @eliphaz256,

For the interaction side of things, I will say that some of the wire connection logic can be handled by using a SocketInteractor for where the wire plugs in and making the wire ends GrabInteractables. There are some existing options for wire/rope/line mechanics between the 2 ends, but you will have to find a tutorial or script that lets you do that. Just from a quick search I found this video that looks promising. As for the other components that need to be “installed” in your training app, you can similarly use SocketInteractors. We have a larger Example project that has some batteries and other multi-grid socket examples that will really help here. The battery that powers the perler machine actually has some key/lock filtering to ensure things only work when plugged into the correct sockets. Hopefully that helps get you a bit further along with the advice Kurt has provided.

Thank You for this advice. The more I go along, the more this advice stands true! So, I’m building a PVSolar Installation and Fault Simulation in Virtual Reality project for my final year of a Diploma in Electrical Engineering(its like an Associate Degree). I have just started using Unity 4 months ago :() I have come to realize that there’s a lot to learn as i go along. I hope to share with you some of my work so that I can be critised, advised and improve. Thank You

Hey Dave, thanks a lot!
Your your direction of advice was a good one, I tried it! though I had problems with my scripts that prevented me from fully implementing it, I hope that when I share my work. My short comings will be seen clearly for further advise. You have my heartfelt appreciation.