Identify the direction of a face.
Hi i have a (maybe silly) question.
If i do a line trace and i hit an object, is there a way to find out in which direction the hit polygon is facing and align an object to it? I have build some kind of interior editor and specially with wall objects it would be nice if i could align them directly to the wall.
Oh our project is BP only atm.
asked Nov 20 '15 at 10:16 PM in Blueprint Scripting
The resulting hit record contains the normal for the impact point. I think you could use that to help solve your problem.
answered Nov 20 '15 at 10:39 PM
Kind of old but I stumbled on it while making my Portal-Gun. I fire a projectile which creates a portal Sprite "onHit" and I want that portal to have a rotation that is exactly like the walls polygon the projectile hit. (Long story short: just like in the game "Portal")
The “rotationFromXVector” Node really solves that. Here is an example of my BP which delivers a Transform with location of the projectile (Can easily be replayed with "hit location") and the rotation of the "polygon" (mesh) that was hit.
Projectile that spawns a portal on hit (only at worldStatic and worldDynamic):
In my example the Sprite of the spawned portal behaves like a decal (has the right rotation compared to the "wall" it's laying on)
This is just a start to solve the problem in the question but I thought I share a pic so maybe others get an idea of what is going on.
answered Jan 31 '17 at 10:52 PM
thanks i have managed it. There was a rotationFromXVector Node that that solfved it :)
answered Nov 21 '15 at 04:16 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here