add local Offset + local Rotation to BoxTraceChannel

Goal: Building system - Collision Check when spawning a buildable piece in multiplayer

All the ghost build logic is done on the client and does not communicate with the server, I do not have access to any information from the ghost build.

So basically, from a line trace I look if there is any currently buildable I can snap the new buildable piece to. If there is any, I would need to spawn a boxtracechannel to a specific location and rotation offset. It is simply a collision check to make sure the buildable doesn’t spawn inside something.

So basically, it would be the same as ‘addactorlocaloffset’ and ‘addactorlocalrotation’, but I don’t need to move anyone, just the transform of where it should be.

Wait but do you have a problem or ?? are you asking someone to make it ?

I would like someone to explain to me how I can calculate the new location. Let’s say I want to snap X piece to Y piece. The server knows Y piece location and X will have an offset from Y. On the client, I simply put an ‘addlocationoffset’ node to set the location of the ghost build then I ask the transform of the ghost build for the boxtrace. But on the server, I would need to calculate the position of where the build piece should be so I can spawn a boxtrace before I spawn the build piece to make sure nothing is colliding with it.

I hope I make sense.

In other words, yes I have a problem and no I do not want anyone to do it for me.

With the piece scale, multiplied by the ( size ) that you know that has… Do you get it ?I just though about it and that’s how probably they do it in fortnite… I hope it helps.

Formula: Unreal ( size ) Scale ( X or Y or Z ) x(multiplied) Size of the mesh, you will have to check the mesh in a 3d modelleing program to check vertices.

I hope it helps. :rolleyes:

Thanks for the reply. I was able to get the boundaries of the mesh and make it works with the rotation of the mesh. The snapping mechanism also works. My problem is to get a specific location of where to spawn the box trace. I’ll try to explain it in another way.

Everything works on the client-side, the snaping mechanism + collision check.

Basically on the client, the collision only turns green or red the material of the ghost build. The client does not communicate with the server. When the player clicks the right mouse to spawn a floor or a wall, the server does almost the same exact code as the client, but it will do it one time and will spawn the buildable if all the condition is met. On the client, it is a loop (timer).

so let’s say I want to snap floor 2 to floor 1. Floor 1 is already in the game and Floor 2 isn’t spawned yet. Floor 2 need an X offset of -400 to snap correctly to floor 1 if I know the transform of floor 1, and I know that floor 2 will need to have an offset -400 on the X-axis with the same rotation of floor 1, how can I know the future location of floor 2?

To spawn the actor isn’t complicated, because I can spawn Floor 2 at the same transform as floor 1 and then use the node ‘add actor offset’ with -400 on the X and it will place the actor at the right location. Although, I would like to do the box trace before I spawn the buildable. I need to know what would be the location of floor 2.

so basically, I would need to do the same as ‘add actor offset’, but to a vector. The server doesn’t have any actor to move yet.

Like If floor 1 doesn’t have any rotation on any axis and I add an offset (vector+vector) of -400 on the X-axis, it will snap floor 2 at the right place. If floor 1 has a rotation and I add the same offset, it won’t snap it at the right place.