Hello there,
I’m currently importing converted level data into my Unreal Engine, which means my imported meshes and terrain all have the same pivot. Essentially, all I have to do is drag everything into my editor and my pre-built world is ready.
Now, everything is still just static meshes, including the light sources. So I wanted to insert point lights. To make that easy and procedural, I planned to do that via blueprint and construction script for all the light source meshes I dragged in.
Problem being, that the point light is obviously created at 0/0/0, and the pivot of the static mesh (added static mesh component) is also 0/0/0, despite the actual mesh floating around somewhere else.
Unreal itself sees the light source meshes in the content browser (you get a close-up on it as your static meshes), so I wondered if it’s possible to search for it in the blueprint as well.
Basically what I wanna do is search for the actual location of the wrongly pivoted mesh (since there’s only one static mesh in the component slot) and move the point light to that location (by using a construction script). Any ideas how I could accomplish that? Since the engine obviously always prioritizes looking at the pivot itself.
I know fixing the pivot and placing the light sources manually would be more “correct”, but then I might as well place the point lights manually, and this is really just a special case that I wanted to manually improve, but maybe it’s possible?
currently none actually. I guess Blender, but I don’t know much about it. Been using 3ds max for all my years until now, but I finished studying and thus my student version ran out.
So by your recommendation you basically mean that each light becomes a “bone” in that sense, and by that I can find the respective sockets?
did some test in MAX…Unreal requires a MESH in the FBX to make it valid so I added a box and also placed a dummy in each light pos then parented all dummies into a root dummy…exported an dI have the skeletal in UE. tricky and i dont know if this is usefull for you because anyway you must place something for each light in your 3d program (but you can script it!)
hmmm, ok. I see what you’re getting at. Of course I’d prefer if there was a way to do it fully inside unreal, but I’ll keep this as a backup plan (especially since I have no idea how to do that in blender yet). So unless I find a better solution first, definitely thank you in advance!
I think most workarounds will involve some scripting from the 3D software side
you can make a script that saves all light locations into a CSV file and you can actually import data in unreal from CSV files (spreadsheets)
Didn’t get a notification for that, sorry.
The bounding box you say? Wouldn’t that span from the pivot to the actual mesh? So the center would still be somewhere in the air, right? Or maybe not? Can I see or get the bounding box somehow [inside unreal]?
No bounding box center is the center of geometry.
you can try getting the bounding box center of the mesh and drawing a sphere at that location (debug draw sphere) to double check.
That worked out perfectly! It’s a bit finicky and only works if the object in question (with the skewed pivot) is at 0/0/0, but that will be the case for me anyways.
It’s still not super great and will be of little use for most people, but for my case it was excactly what I needed! I can just swap the static mesh in the static mesh component and the rest handles itself. Thank you
EDIT: I’ll pin this as the “solution” since our conversation spanned multiple comments and the picture should make it easier to understand.
This is only working at (0,0,0) because it gives you the bounding box in local space.
To convert it to world space, use transform location node. Use GetActorTransform as input for transform and the bounding box center that you calculated in location input.