Basically I’m trying to grab two positions in the world (one of which is in the BluePrint) and attach a rope to them. The movable piece only goes up/down on Z.
I can draw a line between two World points in BluePrints using the “Draw Debug Line” node. Works great.
I can also draw a two-point spline between two World points using a Spline component and using “Add Spline World Point”. Works great…
^^ Neither of these two options is visible in a release build. As soon as I want my line to be visible and live-updated in-game, I get nowhere. This was real easy in Unity using the line renderer.
The Spline Mesh forces me to set points in Local space (WHY?) and I’ve found no good way to convert World locations to local locations in Unreal. Can’t believe I can’t do something so simple.
Just to reiterate: this is in-game (not through the construction script but updated every Tick).
Anyone got any good tips? Been trying for 4 hours… and kind of embarrassed that I can’t figure this out.
Turning world locations into relative (local) locations is quite simple. If you’ve got point 1 that is a world location and a point 2 that is relative to the first point, but all you have are world locations. You just subtract point 1 from point 2 and the result is the relative location of the the second point to the first point. (see blueprint)
But if you need a rope between two points you could also consider using a cable actor between those two points. The only problem is that it does twitch a bit when it spawns, but you can fix that by increasing solver iterations and/or maybe turning it invisible for a frame or two when it first spawns. You can also set the length if you want and make it short for a stretched tight rope or long for it to sag. Edit: cable components can be attached to objects and you don’t have to manually set the locations per tick yourself.
Or another alternative would be to use a beam particle effect ( A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums ) with source and target tangents at 0, and no noise modifier, so it’s just a straight line. Which is really simple to set up, you just have to add the particle system and set the source and target points in world coordinates, kinda like this:
However, the points do move a little bit as the line gets longer, so I solved that by giving the mesh a longer attach-point, so it visually doesn’t bother you.
Thanks for the help! Much appreciated.
Thank you very much! I tried the cable actor solution. To evade the twitch you can create a child from “Cable Actor” (lets call it “Line”), and in details set “Num Segments” to 1 (see the location in image).