x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Location difference between root and static mesh

Hi!

I think I am having a fairly rare problem, in that I would need to figure if there is any way to get the location of the mesh model as it is in level and not the root. Let's say, I have an object that when its root is placed at Location 0, 0, 0, it's static mesh is at location 20, 20, 0, hence clearly offset from root. Is there any way I can get a reference to the location of the static mesh (20, 20, 0) and not the root (0, 0, 0) or their difference?

I would need to figure this out as I have models that are imported to UE from external program where their position has to be exact in their alignment to one another, as I have no other way to set their exact location on the level or import data concerning it.

Tips are as always much appreciated!

Product Version: UE 4.21
Tags:
more ▼

asked Apr 08 '19 at 01:45 PM in Blueprint Scripting

avatar image

TheoT
48 6 8 12

avatar image TheoT Apr 16 '19 at 11:25 AM

Possible solution found: Enable 'Bake Pivot in Vertex' during import.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

the simplest method would be to have a reference to the component (your mesh) that your looking to target then use the get world location node.

beyond that there are methods which use math to calculate the location of the component based on the actors location and the relative location but the first method is much simpler.

more ▼

answered Apr 08 '19 at 03:50 PM

avatar image

ThompsonN13
10.1k 33 9 23

avatar image TheoT Apr 09 '19 at 07:16 AM

Hi! Thank you for your response! I tried the first solution but with no luck unfortunately, is refers to same location as the root always. I tried Get Static Mesh Component World Location and Socket Location but they give the same location as the root has.

Also, in the editor it shows they have the same location albeit they are situated in different place on the map.

alt text

prob.png (35.6 kB)
avatar image ThompsonN13 Apr 09 '19 at 01:53 PM

if the get world location returns the location of the root, then that is the location of the origin of your mesh. it could be that when you exported the mesh from your modeling software the mesh wasnt positioned at 0,0,0 so it ended up being offset from the origin. ue4 doesnt care where the actual geometry of a mesh is for its location, it just uses the origin of the mesh.

so anyway theres only a few solutions if the above is indeed your issue. first you could go back to the modeling software and fix the origin. second you could place a scene component where the geometry is and get thats location, but thats a poor workaround.

also in your picture it makes it look like toilet is the actor and the mesh is the root component. though that cant be right if your explanation is correct.

avatar image TheoT Apr 15 '19 at 02:29 PM

Hi! Thank you for your continued input on this.

To clarify my project; I am importing a 3D map from Blender that is based on an image from which a 3D model has been converted from. The map has hundreds of different objects, thus it is not viable for me manually add an object on top of them all in the UE project as this would take way too much time.

I am trying to make this faster by replacing the models of the map with a new mesh in UE. This does not work due to issue described; the mesh always being placed to coordinates 0, 0, 0. Thus UE is not able to differentiate the root location (always 0, 0, 0) from the actual mesh location which is what I am trying to achieve somehow.

avatar image TheoT Apr 15 '19 at 02:33 PM

Furthermore; I will try to do what was achieved here: https://forums.unrealengine.com/development-discussion/content-creation/44825-origin-point-of-meshes

Automate mesh addition via blueprint add scene component.

avatar image TheoT Apr 16 '19 at 08:17 AM

Hi, Unfortunately adding scene compoment did not work; it still adds the mesh always to to 0, 0, 0, even if scene compoment is added. I would have to manually add the component to the location of the mesh, which is not a viable method as I have hundreds of objects.

Edit: Possible solution found: Enable 'Bake Pivot in Vertex' during import.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question