User defined cable start and end point

I would like the player to click one spot, and that’s the cable starting point, and then click another spot and that’s the cables end point. Any clues?

Does the cable already exist? Or are we adding a bunch of cables as we click?

It might be a bit annoying to orient a cable with a predetermined mesh- in that case, it seems Everynone might have an idea.

But if we can just create something new, I suggest using a cable component- appropriately enough.
To use this you can simply get where the player clicked and set the cable’s world location and end location. World location is the normal everyday world location of the component, and the end location is a variable.

I recommend also setting the cable length at runtime. The cable will still connect no matter the length, but you won’t get that cable droop.
Length of 0:

Length matching the actual length:

adding a bunch as we click

thanks for the reply.

Where does the blue “Cable” node come from?

Is it a variable? an actor thats spawned?

It’s a component that you can spawn- though you do have to enable it under plugins

image

tl;dr: do not make the player the component owner


Last week I made three versions of this. The conclusion is that, due to the way component ownership, the cable attachment and simulation rules work, the best course of action seems to be making a dedicated actor that spawns cable components - an actor that is, ideally, not associated with the player in any way.

Here’s the dramatically simplified version that spawns cable actors instead:

  • the cable actor:

  • the function that gets relative transform of the component we’re attaching the cable to:

  • the player placing cables in the world:

All in all, great exercise - I learnt a lot about what not to do. :innocent:


As mentioned at the start, I’d probably opt for another actor spawning just components. This way we wouldn’t need to worry about attachment rules.

If there’s a better way of doing the above, I’m all ears.

1 Like

hey
what is the variable in (hit component) in return node?

Not sure what your mean. Could you clarify?

I think they’re talking about this

In which case it’s whatever the mouse is hovering over at that moment

I wanted to ask you a question regarding the code shown in the picture linked. In the Break Hit result node what is the variable type for the Hit Component that is connected to the return Node?

You can mouse over any pin to find its type:

image

You can also:

1 Like

thank you we will try that

we try it but it won’t work
it says (can’t edit this node)

Could you provide more details regarding what you’re doing and where?

Blueprint Interfaces

You cannot script inside the interface, but you can add appropriate outputs:

The script goes into the actor’s implementation of that function.


we try it but it won’t work
it says (can’t edit this node)

Where does it say it? Please add more details. Ideally post a screenshots so we can better understand what is going on and how to help.

Click the error to see where the issue is.

When I connect hit comp with attach to comp error