Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by a_flux · Dec 19, 2013 at 03:34 PM · mouseclickmove an objectclicktomovemousemove

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

mouse.move.txt (2.5 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

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:

http://wiki.unity3d.com/index.php?title=SetPivot

Comment
Add comment · Show 42 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image a_flux · Dec 21, 2013 at 05:31 PM 0
Share

Thanks a lot robertbu, I'll go through your steps and inform you back. Cheers

avatar image a_flux · Dec 23, 2013 at 11:07 AM 0
Share

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???

avatar image robertbu · Dec 23, 2013 at 05:30 PM 0
Share

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.

avatar image a_flux · Dec 24, 2013 at 12:01 PM 0
Share

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.

avatar image robertbu · Dec 24, 2013 at 12:03 PM 0
Share

What script are you using to move the object?

Show more comments
avatar image
0

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image a_flux · Jan 11, 2014 at 07:29 AM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges