Player places objects on walls - how to get proper rotation of objects

Doing it manually is a no go in most cases, true. You have options here, though:

**- ideally: ensure the meshes have their pivots at the base and always face X - this way they will never sink into other geometry

  • alternatively, you can offset the static mesh in the editor by attaching it to a root / another scene component, this is my torch:

Above: the static mesh’s scale Z is 1, I know this mesh is 50uu in Z; if I punch in +25 in Z location, the torch will be offset perfectly with its base touching the ground when I make rotation from Z and plop it on any surface.

  • you could use static mesh component’s bounds as the offset, it spits out a radius float equal to the half of the largest dimension in either XY or Z; while it would work for anything oblong that needs to stand up, it would not work for a car that’s rolled over to its side. Not without extra work, that is.
  • there is also a somewhat involved technique useful when dealing with irregular (regular, too) shapes at precarious angles. What is known as *Sweep *in UE4 allows one to find a location where an object *would *start overlapping. Think of pretending to drop something onto a surface and attaching it where it touches it. Sweep can find the first contact point and final resting location. You’d need meticulously crafted collision for that to work precisely, though. [HR][/HR]
    Not sure what you need this for so hard to advise. The first suggestions is generally a step in the right direction. Who knows, you might be attaching torches to walls or bombarding monsters with spiky blobs - you’d need a different method for those.

edit: You did say objects on walls, so fix the pivots and you’re done.