How to spawn an actor on walls aways facing the same direction ?

Hi all

I want to spawn actors in game on walls and ceiling but i want them to aways face them in the same direction. Like spawning a picture it should not be turned with the backside first. Is there some easy solution to do it ?

Get Hit → Normal → Make rotation from the desired axis. Optionally combine it with another axis to get rid of ambiguity.

Hi

Im not sure if i understand this but it has to do with the transform/ rotation after line trace yes ? So i will have to adjust it somehow. lets say if either hits a wall to the east or wall to the west directions should change accordingly. Only thing i still don’t know how

Here is my line trace:

Do i need some branch like If it hit wall (east) set rotation… ?

Do i need some branch like If it hit wall (east) set rotation… ?

Normal tells you the direction the hit surface is pointing to.

We’re treating the wall’s normal as forward (X) and ensuring up (Z) always points up-ish. Unless it cannot because X goes first.

2 Likes

Wow this looks so cool and it awso fixes another problem what i had.

Is this possible to make 2 objects not stack/build on top of each other as well as moving in a grid pattern like my “snap to grid” nodes ?

Yeah.

  • I told the actor on the wall to Ignore Visibility traces (ideally, we’d set up a new channel for this). The walls do Block this channel.

  • when I trace, I do so using that Visibility channel:

image

It’s impossible to hit the actor on the wall with this.


a grid pattern like my “snap to grid” nodes

That’s the way to do it, yeah.

This might be enough, but may need more work - really depends on what we’re dealing with, shapes and all. You may need to work in some offsets. A picture is flat, an elk’s head trophy - not so much.

Is there some easy solution to do it ?

Usually, there is not.

Awsome stuff thx i really appriciate the help.

I will have to start testing how to implement it in my system. The problem that i have is that i awso have a preview mesh of the actor befor spawning and there is the line trace. And “Spawn Actor” node is located elsewhere so i cannot directly connect "Make Rot from XZ to the Spawn actor node as you do. I think i will find workaround but have to test.

So far connecting this ROT XZ node fixes the problem with facing the right sides when spawning on a wall but adds new problem with some clunky movement on my preview mesh actor. Like i say is not 1:1 like you connected it because i don’t have line trace that go directly to spawn actor.

And btw the actors that i spawn are traps so they have a pretty uniform form almost like a flat block with equal sides.

Have a look at this:

This is uniform and has a preview. Perhaps there’s some inspiration there.

I will check it out and see what i can learn from it.

Here is my system for building the traps with the preview mesh. I acctually really hope i can somehow sneak this “ROT XZ” node in there.

Line trace - at the end there is only 1 more node some delay node but thats it basicly

And here is “Spawn Actor” located:

Make sure you have a value here:

image

Otherwise things may flip.

Acctually this whole thing helped by a lot ty.

I awready see the potential and it awso fixes another problem that i had with placing traps on a lets say a 45° ramp (Befor it worked only on perfectly flat surface so 90° for example). I can do it now with what i have from your nodes added to my system. I will really have to dig deeper and refine it till this fully works. Unfortunatly I don’t have more time right now but i will come back later in few hours and start working on this.

Oh no, existential dread from this thread:

Some good info, there, though. Very on topic.

1 Like

Ok what i got so far - My Wall trap works on walls and when i spawn it aways turns to the right direction as it should. But my problem or 1 of them is my preview mesh. I try to achieve that when im line tracing with the preview mesh where to spawn my trap the wall trap should only show up when aiming at the wall and not be seen when i look on the floor.

I was thinking to maybe use tags on line tracing somewhere something like making all Walls in my level with a tag “wall” and all floor with “floor” tag same for ceiling. So maybe using a branch “if” the target i am aiming has tag “wall” and is = to my wall trap which awso will have the tag “wall” then show up the trap preview mesh. Aiming at the floor should immidiatly remove the wall trap preview mesh and do nothing. Same should work with floor traps. I should not be able to aim at a wall and see my floor trap up there at all… Is this the way to do it with tags ? Or is there a simpler solution with trace channels Like you mentioned earlier here?

So far if i skip this problem for now the wall trap works as it should but it wont spawn on 45° ramp. Its “red” where it is set that something is blocking it to build but it does not look like it is and the same happens to floor traps (wall traps should not spawn anyway on the floor). I can send some video example in a min… Floor traps should be able to spawn on ramps but never on walls or ceiling. Wall traps only on walls and ceiling traps only on ceiling. Thats it acctually.

Edit: The rotator node and “Vector snapped to grid” both solves the issue with my wall spawning in the right direction on my walls now. I guess this topic is solved.

I will try now with the trace channels and see if i can fix the other issue and i have a few other ideas as well for it. If nothing works i will open a new topic.

Thx a lot for the help i really appreciate it ty.

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