• 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
Question by alexnode · Mar 30, 2010 at 07:51 PM · animationrotationparent3dsmax

How to correct the First Person Controller orientation when parenting to a rotated x.270 degrees model?

Hi all, I am creating a simple lift and I have a problem. The lift is an imported model with animation, I attach the first person controller to the animated platform and it turns 90 on the side. Here is my code and some photos of the scene. Is there any solution to that? Can i rotate the controller after I attach it? something like FPCobject.transform.Rotate(Vector3(270, 0, 0),Space.Self);

if((hit.gameObject.tag == "liftani") && (showMenu== false)) { MouseLook.mouseLock=false; FPCobject = GameObject.FindGameObjectWithTag("Player"); FPCobject.transform.parent = hit.transform; FPCobject.transform.Rotate(Vector3(270, 0, 0),Space.Self); moveFloor(liftMoveSound, 3, "platform2_3UP", currentPlatform); //print(MouseLook.mouseLock); //FPCobject.transform.parent = null;

 //showMenu = true;
 }

the hierarchy

the problem

Comment

People who like this

0 Show 0
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
Best Answer

Answer by duck · Mar 30, 2010 at 08:00 PM

How about just fixing the pivot orientation of your lift object (i.e. change it so that Y = up), in the 3D app that you used to make it?

Comment
runevision
alexnode

People who like this

2 Show 5 · 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 e-bonneville · Mar 30, 2010 at 08:00 PM 0
Share

@Duck Yeah, I was going to suggest that, but I didn't know which app he was using...

avatar image alexnode · Mar 31, 2010 at 08:42 AM 0
Share

Thanks guys, model is coming from 3ds max, which I think it is NOT a very good idea after all! The model belongs to an hierarchy that has other animations too. if I change the pivot and put the y up (maya style) the platform comes on the side and I have to do the animation again because max stored the animation in world coordinates. I am importing from .max file directly which I thought it was such a cool feature !!! I am going to do a few more tests with rotating the pivot and let you know. Is that problem only for .max and z-up 3d apps?

avatar image alexnode · Mar 31, 2010 at 10:12 AM 0
Share

OK I rotated the pivot like maya, and i have a very weird result. Everything works fine apart from the fact that the platform appears on the side in the beginning. when I activate the animation to go to another floor the platform turns straight and everything works fine ! It is a bit beyond me ...

avatar image alexnode · Mar 31, 2010 at 12:20 PM 0
Share

Ok the only workaround I found is as you said to change the pivot, you turn in 3ds max the pivot to x:90 Y:0 z:180, the model comes on the side but the animation moves it in the right place ( Very weird). So I added an autoplay animation to play once in the beginning and then it works. I mean that is an ugly hack ! I can't figure how it works and what Unity does in the import. What if in the asset importer for max files whenever you read z you output y and x = -x (or something like that?). Is it more complicated ?

avatar image alexnode · Mar 31, 2010 at 05:14 PM 0
Share

I reimported the model and the FPC rotates exactly as it was in the beggining the only difference is that the pivot is with Y up in the model. it's a mesh alexnode 0 secs ago

avatar image
Best Answer

Answer by e-bonneville · Mar 30, 2010 at 07:54 PM

The answer might be as simple as creating an empty gameObject and putting your lift inside it. Then, add colliders so that the new gameobject gets the hits, not the lift itself. Then, add your code to the gameobject, and you should be set to go, since gameobjects by default are not rotated at all, thus no rotation of the camera when parent/childing.

Comment
alexnode

People who like this

1 Show 7 · 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 alexnode · Mar 31, 2010 at 08:43 AM 0
Share

Thanks elbon96, I have six different animations in this model and I would prefer to find a solution of not braking up the original file. if I put the animation on the root GO then the static geometry will move too. If I don't find any other solution I will have to do it as you describe, thanks. I think that I modelled the animations in the wrong way to be honest ... with this 270 degrees import issue from max.

avatar image e-bonneville · Mar 31, 2010 at 11:40 AM 0
Share

Yeah, that can get funky sometimes... To be honest, I like importing my models from Blender and baking them. See this answer on how to...http://answers.unity3d.com/questions/4993/imported-model-gives-error-transform-rotation-is-no-longer-valid. Look at the answer on the bottom.

avatar image alexnode · Mar 31, 2010 at 01:21 PM 0
Share

It is true that max doesn't have built in baking but there is a very nice script that does the job. But when you have different shaders and objects that react differently to scripts you don't want to bake anything.you want to keep them separate under the same hierarchy.The main problem is that the import from .max files does a funny thing of rotating the object x:270 degrees while the model appears straight. which is cool for static geometry but a problem when you want to attach something in runtime. And I am sure that I will find other problems too in the future. Thanks for the info

avatar image e-bonneville · Mar 31, 2010 at 02:46 PM 0
Share

Hmm. By baking I meant bake the rotations and transforms so that they are imported as 0,0,0 rotation. If you can export as collada from max (I've never used it, I don't know), download and install blender and then bake rotations from there. I don't know if I misunderstood you, but it seemed that max bakes differently from blender.

avatar image alexnode · Mar 31, 2010 at 03:50 PM 0
Share

by baking I understood that you bake some sort of modifier based animation like a ripple or bend effect (that cannot be imported to game engines) to vertex animation or different layered character animations to one . sorry. hmm i am not sure but i think the animation itself is imported correctly from max . I have to import a character to see more complicated staff concerning the rotation. The thing is that there is a maya machine in the studio and the import works ok. But I am interested in some rapid prototyping from max because we use max. The thing is that i am losing the "rapid"

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Why does animation affect rotation? 1 Answer

Rotating An Object On Its Axis Once 3 Answers

Unity Animation: Rotating only One Axis 0 Answers

Scripting: make thing repeating 3 Answers

Animating the rotation 0 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