- Home /
Imported skehup into unity not moving as I want!!!
I've created a model in sketchup, after exporting it into unity, I am using 2 kinds of scripts to move my model, one written in JS and another in C#, both scripts work perfectly for any cube of sphere I create within unity but not for my imported model. the imported model does move but in strange angles. for example when I click via mouse on any area on my floor the cube comes from where it's located to that point precisely and stops, when I use the same script for my model, my model comes from a different location (from the edge of the floor) and doesn't even stop on the spot where I click my mouse. Please I've been searching forums for a week and couldn't find any help or answer. Any help or advice is greatly appreciated. I am attaching my 2 scripts for you to clarify the idea. Thanks link text
Answer by robertbu · Dec 19, 2013 at 03:46 PM
If your script works for a cube but fails for the model, then it is highly likely that your pivot point for your model is not in where you expect (in the center) of the model. As a quick test, place a sphere at location (0,0,0) and scale it down to (.2,.2,.2). Now create your model in the hierarchy and place it at (0,0,0). If the model is built 'correctly' then it should be at the same position as the sphere.
The best fix is to move the pivot in your modeling program. Alternate fix #1 is to use an empty game object.
Place an empty game object at (0,0,0).
Add your model, move your model so that it appears at you would want it if it was placed at the origin.
Make the model a child of the empty game object by dragging it on top of the empty object in the Hierarchy view.
Scripts go on the empty game object.
Another solution is this editor script:
Thanks a lot robertbu, I'll go through your steps and inform you back. Cheers
I've tried the test of creating sphere and yes my model replaced the newly created sphere. The second possible solution I've tried too but no luck. Any other ways of sorting this out. $$anonymous$$y imported model still moving in a strange way to that of cube or sphere created with in the unity program???
Your rotation is probably wrong.
Create an empty game object at the origin
Place your object at the origin
Rotate your object so that its front is facing positive 'z'
$$anonymous$$ake your object a child of the empty game object
$$anonymous$$ovement scripts go on the empty game object.
I did that, empty object at the origin, put my model inside it and rotate it towards the + Z and then attach script to the empty game object. And still moving from all around the terrain unlike the cube or the sphere, Plz help.
Answer by Prd_Animator · Jan 10, 2014 at 06:38 AM
@a_flux seems like you changed axes in sketchup,robertbu gives you good solution but unfortunately you are not understanding what he was trying to say, anyway here is another solution,
1)save you sketchup model and hit ctrl+n. 2)go to file and import your model 3)place your model on the origin of axis's
now export in unity and put 0,0,0 in position you will see your model is in right place.
Thanks $$anonymous$$ate, but it's all been sorted with the help of reobertu, but I'll keep your steps for future references. Thanks.
Your answer
Follow this Question
Related Questions
How to avoid instant GetMouseButtonDown-checking when instantiating object with button? 1 Answer
"Working with moving and mouse touch to set coordinates" 0 Answers
Moving objects with *Isometric* mouse position (JS) 1 Answer
How can I move an object to a clicked objects (center of X,Z) coordinates (board game)? 0 Answers
How to make moving character like in Feeding Frenzy? 1 Answer