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 DeveLOLper · Aug 14, 2013 at 12:37 PM · importmodelcarsketchupy axis

Imported model moves in the wrong direction

 var speed : float = 0.3;
 var acceleration : float = 1.0;
 var deceleration : float = 0.3;
 var brake : float = 0.4;
 
 function Update () {
 
 if(Input.GetKey(KeyCode.S)){
 transform.Translate(Vector3(0, 0, speed));
 speed = speed + (Time.deltaTime * acceleration);
 }
 if(Input.GetKey(KeyCode.Space)&&(0 < speed)){
 speed = speed - brake * Time.deltaTime;
 transform.Translate(Vector3(0, 0, speed - brake *Time.deltaTime));
 }
 else if(0 < speed){
 speed = speed - deceleration * Time.deltaTime;
 transform.Translate(Vector3(0, 0, speed - deceleration * Time.deltaTime));
 }
 }

When I use this script to a random block in Unity it works but when import a car model from Sketchup and try it, when I press the up key for it to go forwards, it goes up the Y axis! I'm pretty sure I aligned it correct in Sketchup so what's going on!?

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

Answer by Joyrider · Aug 14, 2013 at 12:38 PM

Be carefull, the objects' axes often change for imported objects, because of differences in axes and spacial logic between Unity and the modeling programs

In Sketchup, just like in 3DS Max, the up vector is the Z-axis.

Unity has the y-axis as the up vector and the Z axis as forward vector.

And Unity and Sketchup both use different Coordinate systems (LeftHanded vs. RightHanded) This causes axis to be different between your modeling program and Unity.

Comment
Add comment · Show 3 · 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 meat5000 ♦ · Aug 14, 2013 at 12:43 PM 0
Share

Yes! Rotate the model in $$anonymous$$odelling software so Z is forward and Y is up, then re-export.

avatar image Joyrider · Aug 14, 2013 at 12:45 PM 0
Share

Not sure that is going to solve it. The axes usually don't stay the same.

avatar image meat5000 ♦ · Aug 14, 2013 at 12:55 PM 0
Share

It happens to me with Blender. Z and Y are different so models always import on their backs

avatar image
0

Answer by meat5000 · Aug 14, 2013 at 12:59 PM

In your Translate scripts try:

 transform.Translate(Vector3(0, 0, speed, Space.World));

as an example. Space.World as suggested performs movement in world space. If left out it defaults to Space.Self, the local space.

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 Joyrider · Aug 14, 2013 at 01:09 PM 0
Share

If you never change direction cf. Rotate, than yes, you could try this. Otherwise, it'll get pretty complex.

You're better off setting an empty gameObject as parent of your imported model and put your scripts on there.

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

17 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

Related Questions

Are Imported SketchUp files bad for optimization? 1 Answer

Shooting an Arrow (Blender Model issue?) 1 Answer

Too many material elements on Blender imports? 2 Answers

Is it possible to make a model in a program then import it to unity make a terrain and place the thing/building on the terrain and export the whole thing BUT then import it into Skyrim? 0 Answers

Blender import issues. 2 Answers


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