Possible to grab and then attach several actors to one another?

Hi!
Hi there! I am attempting to connect multiple objects together in a molecular chain or structure fashion whilst in VR.

Currently, for testing in the VR Template for the Vive I have two blueprints - one for the nodes and one for the bonds. The ‘nodes’ are simply cubes with a collider components on each face and the ‘links’ are cylinders with colliders at either end and I am using overlap events to attach the ‘link’ to the the ‘nodes’ components.
Right now, I am able to connect a node to either end of a bond but when i try to attach (using attach component) a further bond to one of the nodes then the node detachs and joins to the new bond rather than expanding the exisiting formation.

How can i extend this structure? Is it possible to connect A to B to C to D and so on?

Included is the blueprint for one of the six sides of the ‘node’ and also for the ‘link’

You need a boolean that clarifies whether a node has connected to a bond or not.
Also you need a case in your bond that attaches it to a node when it’s already connected.

Kind regards

Schnittbrot

Hi thanks for the answer! May I press upon you to please expand on this a bit? How should I form the logic for the case in the bond you mentioned? I have been banging my head against the wall for a few hours! Would you like to look at the project maybe?

Wow thanks! and thanks again for the explanation!
I have implemented the logic to the bond, altered the script slightly to use on the nodes and I have the resulting connection of Node—Bond—Node. I am now attempting to extend the structure further by adding another bond to one of the outer nodes as at the moment it is unsuccessful. Currently I can attach several nodes to either of the bond connections at once but can only attach one node to one bond- A bond connection can have many attachments but a node can only have one it seems.

I am assuming that in order to expand the structure I should be attaching the new bond to the ‘attach parent’ of the attached objects so I am looking at doing this now. I was thinking a branch after setting the Empty Actor Variable and before the AttachtoComponent function to A)Check if the actor is attached to another actor(not player hands/controller), If not then attach to actor B) If attached then to get the attach parent and connect to that.
Is this along the right lines you think?

Wow thanks! and thanks again for the explanation!
I have implemented the logic to the bond, altered the script slightly to use on the nodes and I have the resulting connection of Node—Bond—Node. I am now attempting to extend the structure further by adding another bond to one of the outer nodes as at the moment it is unsuccessful. Currently I can attach several nodes to either of the bond connections at once but can only attach one node to one bond- A bond connection can have many attachments but a node can only have one it seems.

I am assuming that in order to expand the structure I should be attaching the new bond to the ‘attach parent’ of the attached objects so I am looking at doing this now. I was thinking a branch after setting the Empty Actor Variable and before the AttachtoComponent function to A)Check if the actor is attached to another actor(not player hands/controller), If not then attach to actor B) If attached then to get the attach parent and connect to that.
Is this along the right lines you think?

I quickly wrote up the logic that you’d need for the Bond Actor.
The node Actor would need a pretty similar setup.

OnOverlap the left_col or right_col colliders check if they already got an attachment. If this ain’t the case they set the variable “OverlappingActor” and Start the “Attach Node to Bond” event.

The event takes the OverlappingActor and casts to the Node Actor.
If the cast is successful it gets your player controller and the attached motioncontrollers.
The controllers from the VR template have an “AttachedActor” variable.
The event checks if there’s currently an actor attached to any of the controllers
and if an attached actor is similar to the node actor we overlapped with.
When an actor is found that meets this criteria, the AttachedActor variable of the motioncontroller
is being overwritten with the “EmptyActorVar”, this sadly is the easiest way to set this variable NUL.
With replacing the AttachedActor we detached your node from your Pawn and now can attach it to the collider it overlapped with in the beginning.

I haven’t tested the logic but it should come pretty close to what you need.
I hope this helps you out

Greets

Schnittbrot

This sounds like a good direction to head in :slight_smile:

Don’t forget to mark this as resolved when you got it functioning!

So here is where I am right now with the Node. I am checking to see if the overlapping bond has an attachment parent and attempting to attach to that on eventoverlap. However, this is still not working and I do not see the solution.
Any suggestions?

Is there a particular reason why you have a single class for each atom?

Your logic flow would be more like this:

-Check the overlapping actor for bond tag
-use the “Get Owner” node to see if the bond is attached to something else

The rest should work as usual