How to get an offset from an actor in level without vector or arrow component?

Husselcroe
Sat, 14 Jul 2018 16:20:07 +0000
Blueprint

Hi everyone im working on a project, in which i need to place actors (buildingparts) in the level.
The buildingpart class contains a static mesh and arrays of transforms which are the offset values.

There are two actors of that class involved in that situation:
Traced actor is already placed in the level and current actor which is the one i want to place next to traced actor with the offset.

In PlayerBP i have a custom event that does a sphere trace each frame as long im trying to place down the current actor, then it adds the offset to the location of the traced part. The offsets are x and y axis values.

Now to the problem, this method works as intended as long the traced parts rotation is -180 -90 0 90 180 but as soon as the traced part is no longer on 0 0 x y rotation the offsets no longer work as they should i know that the locations are no longer the same as my math just adds x and y values when its rotated.

Soi tried out to work with arrow components in the buildingparts and that worked pretty well but the problem here is that some buildingparts have a big amount of possible “snappoints” and if there are maybe 100 or 200 of these parts present in the level it may cause performance problems.

In the screenshots you can see those blueprints and the results in the viewport
The first image shows the custom event which adds the offsets and saves the final resulat as a transform.

The second image shows another event which does the same but it takes the information for the offset not from class defaults of the buildingpart it does take them from the arrow components in the buildingpart. There is only one of them wired up at the same time, its just a different approach.

on both viewport screenshots the left 3 cubes were placed with a 45 degree yaw rotation while the left 3 cubes were placed with a 0 0 0 rotation as you can see on the first image when im using the transform version they get not placed where they should be when rotated. on the second one you can see the result with arrow components which is how it should look.

Is there a way to achieve the result of arrows with only math? if yes how would i approach that ?

I readed into vector use in ue4 but it seems i would have to preset absurd amounts of possible offsets to cover all possible rotations.
I need to keep the buildingpart actors as simple as possible while maintaining functionality, thats why i also can’t destroy the arrow once a part is placed because you may want to build onto that part later on.

Any suggestions or advice on this topic is welcome and appreciated.

Thanks for your time and have a nice day.

4 posts - 1 participant