How to get the hit location of sphere trace in World Coordinates

I have some blueprints scattered across my map and in each one they do some sphere traces, if the trace is successful then it’s supposed to drop a tree at that location.

The problem is that the OutHitLocation is given in local space, I tried to add the BP actor location to the OutHitLocation which almost worked BUT most of the blueprints are rotated so that also throws off the placement of my trees.

There should be an easy way to get the local vector in that BP and just convert it to world space, but I can’t figure out how.

1 Like

It already is world space. Can you show your code?

The first pic is my sphere trace that outputs the location of the hit and sends that to my MakeTree function.

This second pic just shows that the only thing my MakeTree function does is add an instance as the same location that the sphere trace outputs.

I can confirm that IF I subtract the OutHitLocation by the self Actor location and use that value in the MakeTree function AND the BP is at 0, 0, 0 rotation then it does create a tree exactly where it is supposed to.
When I run the code as it is in the picture (without subtracting the self ActorLocation) then it spawns the trees waaaaaay off.

I think in explaining this I even confused myself, let me know if you need any more info/screenshots.

I think the problem is your ‘add instance’, that is expecting a local coordinate, and you’re giving it world.

Why don’t you have this?

image

Lower engine version?

PS: If you have to stick with that node, just say, and I’ll show you how to convert to local space.

2 Likes

Not sure why I don’t have that option BUT it turns out I have another node called “Add Instance World Space” and that did the trick.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.