I have a Model that I've made with 3ds max, and a little game, I want to create that object in the character's position when I press "T" for example, how would I do that?
Answer by hdgam3r
Sep 10, 2012 at 01:58 PM
First of all, you must make a Prefab that contains your 3DS Max model.
Then, you just need to instantiate it by using Instantiate in your script, you can even pass the position where you want your object to spawn.
Answer by whydoidoit
Sep 10, 2012 at 01:57 PM
You need to create a new game object and set its transform.position and .rotation to the character's position. Then you will need to add a MeshFilter component and a MeshRenderer component. The MeshFilter's shared mesh needs to be set to the object you created in Max.
public Mesh objectToCreate;
var gameObject = new GameObject("Some Name Here");
var meshFilter = gameObject.AddComponent<MeshFilter>();
meshFilter.sharedMesh = objectToCreate;
gameObject.transform.position = transform.position;
gameObject.transform.rotation = transform.rotation;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
12 People are following this question.
script dosnt creat object where i want it to
Scale Cube script Help? (In-game via mouse)
Export object stack FROM unity with textures
Disable GameObject Only Father Not Children