Accessing dummy objects from FBX (in script)

Hello, I have some fbx model with some dummy object2 that I would like to access to take its position (relative) and use to set some other visual features in that relative position (for example a weapon in a body, a bullet in the weapon extreme, etc.

I can see in the project inspector the fbx, that have (in my case some mesh and 2 dummy objects)

Should I use AssetPostProcessor?
Maybe instead of dummy objects should I use another techniche?

In resume: which is the best approach to obtain from a model “some points” and its positions to use them?

Any help is appreciate.

Thanks.

Using dummies and creating a hierarchy works.

Then you can use scripts on the root object and use transform.find([Dummy Path]); to retrieve specific dummies.

Thanks for you replay.
About the transfor.find it is ok.

But about the first part “creating hierarchy”, how to do it?

Should I do this from AssetPosProcessorModel?

Because I can see in the project part the hierarchy with dummies, but not in the “hierarchy part” of the editor.

Some point is that I am using a prefab for the “root object”, this root object hast some mesh filter that ask for a mesh no a fbx model (this fbx is the one which have the dummies also).
So in the “root object” from script the dummies would never exist (or would they?)

I am going to try using the dummies using AssetPostProcessor, is there another way.

Thanks again.
(Using pro version if matter).

I’ll try to clarify some of the syntax.

An FBX represents a model.
One model can contain many meshes.
The meshes are the individual pieces of geometry drawn, and are cut up into separate objects within the model.

Unity takes an FBX, and creates a prefab with all the individual meshes. If you drag the prefab into the hierarchy view, you should be able to open up arrow and see all the individual meshes. The Hierarchy is organized inside of your 3D editor, and is built by Unity in prefab form, Dummies included.

The Dummies will show up in the level as GameObjects without a Mesh Filter or Mesh Renderer, similar to the root node of you object.

You do not need an asset post processor for them to appear in the scene within your model, they are already there if implemented properly within 3D Studio or Maya, or Blender.

Dummies count as Meshes. This means that if you have a dummy called ‘Point1’ it should show up inside the Model. They react the same and can be parented to and animated just like other objects in the scene.

You can create an internal hierarchy in 3DS Max or Blender or Maya with parenting, and that allows the dummies to be properly animated for animated models (good for adding armour points).

It is important to note, that prefabs in the Project view are only 1 layer deep, so if you have 5 layers of parenting within your model, you will not be able to see it. They are still usable and modifiable in game, but they cannot be seen in the project view.

A Prefab in the Project panel contains the same information as the Hierarchy panel, and the only difference is that the Hierarchy panel lists what is currently in your scene, where as the Project panel is all assets you may use in your game.

How are you loading the Mesh into the scene, as if a prefab changes structure from library to game that would be a major bug.

Thank you , I understand.

However the way I have my project maybe is not good for this.
Let me explain:

I have a prefab which have some mesh filter, mesh renderer, rigid body, and some script.
This prefab (let’s call it PrefA) has in mesh filter some mesh.
Where did I get this mesh?

Well this mesh comes from a fbx model which as you correct explain is show as a prefab (but with a paper small icon) and its compoment (2 dummies and one mesh), lets call it “PrefDummy”.
Well in the mesh selector you can select a mesh so I use this mesh.

In my game (runtime) I instantiate PrefA, which has its model texture, rigid body, everthing working fine, but… how do I access dummies from PrefDummy?

Should I besides instantiate PrefA,instantiate PrefDummie?

Please note, that prefDummy is not a real prefab, I can not add any kind of of component to it (they are all gray in editor).

Thanks again and sorry for the miss explication.

Ah ok, now I understand the situation.

Yeah, AssetPostProcessor works, (with OnPostProcessModel) you could add the Rigibodies and other scripts from there.

You can also drag PrefDummy onto PrefA, and then it becomes editable with the dummy objects. This causes PrefA to have the dummies and structure of PrefDummy, and then add the scripts afterwards. This can be scripted into an Editor button as well.

It’s important to know that the animation does not need the exact mesh. For example, your Pref Dummy is this:

Root
->Body
->->Head
->->->Eyes
->Limbs

And you want to animate the Head.
You can animate any Unity objects with the structure:

[Your Prefab]
->Body
->->Head

For those animations to work.

This means if you animate an object called Shoulder in 3DS Max, and then create an empty gameobject called Shoulder inside PrefA then the animations and connections will work perfectly. You can even make many different models, and so long as they have the same structure for their prefabs with regards to naming, the animations will work for all of them.

A Dummy is just an empty GameObject that is created in your 3D program.