• 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 TehWut · Nov 19, 2011 at 05:52 AM · camerarotationguns

weird rotation with camera (no code issue)

Hello, I have a camera with 3 child game objects (pistol, rifle, shotgun) within each, I have a gameobject called "aimobject", and within that is the gameobject with the mesh.For some reason, when I look up or down with the camera with the rifle, it doesn't seem to rotate on track with the camera, it kind of rotates on it's own. (it's hard to explain). Like, it kind of sways in the opposite direction.. I thought it had to do with Apply -> scale, but that didn't seem to change anything. It doesn't seem to be a Unity issue either. I am using Blender, is something wrong with the rotation/location or orientation?

Comment
Add comment · Show 8
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 aldonaletto · Nov 19, 2011 at 07:23 AM 0
Share

Are the scales uniform? If the parent have a non-uniform scale (different scale in one or more axes) the child gets skewed when rotated.

avatar image Bunny83 · Nov 20, 2011 at 02:45 AM 1
Share

Are you sure you don't have any script attached to one of the child-objects? I mean not just the rifle or shotgun object, also the childs of those objects down to your mesh. It sounds like you use LookAt or something like this on one of your objects. You should start by searching the point where the rotation occurs. Just run the game and check the objects in the inspector to find out what object actually gets rotated. Child objects never move on their own except you have a script that moves it in any way or it has a non-kinematic rigidbody attached which shouldn't even be on child objects.

btw. it is possible that a script on a different object influences your child object from elsewhere. $$anonymous$$aybe you assigned your object to a script variable. But that guessing is quite pointless since we don't see your setup and scripts.

avatar image overunity3d · Nov 20, 2011 at 03:18 AM 1
Share

Look at this. It sounds like this is similar. http://www.youtube.com/watch?v=Vi4XTYREXv0 I posted alot on this site in different ways. And another one: http://www.youtube.com/watch?v=9yi5knkcTnc

avatar image Bunny83 · Nov 20, 2011 at 03:51 AM 2
Share

@overunity3d: well, that's what i said. Rigidbodies are ALWAYS simulated in world-space even when they are childs of other objects. The documentation mentioned that, not very clearly but it is there: Rigidbody component.

In general you should avoid parenting a rigidbody to another moving / changing object. The position will be translated (so it will move along with the parent) but all physics properties (esp. velocity) will stay in world space.

Btw. If that video is from one of your questions it would be ten times more useful when you link the question...

It's never too late to solve old questions ;)

The problem in the video is that a physics system tries to simulate the real world. Due to momentum an object will always try to keep moving at it's current velocity and direction. In space you can orbit around large object because of gravity (not the simplified earth-gravity). If there's no gravity between the orbitting object and the object in the center it can't orbit, why should it?

avatar image overunity3d · Nov 20, 2011 at 04:34 AM 1
Share

Let me ask this so that is fits here. How do we create things moving in a gameobject but spin that gameobject with the objects in that gameobjects moving correctly, like fire and forget. we fire a missile then turn away but the missile stays on track? As you can see in my video the objects just swish around ins$$anonymous$$d of staying on track. But let me specify that the objects don't have a target just a straight forward destination in the spinning game object.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by TehWut · Nov 20, 2011 at 04:47 AM

Argh!! I spend two days sweating over this, and the mesh was not set to the proper layer to render in the correct camera! The whole time it's been disconnected. Thanks for all your help...I would've been on a wild goose chase in blender! thanks again!

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 Bunny83 · Nov 20, 2011 at 06:01 AM 0
Share

Don't forget to mark an answer as solution so the question is answered. Since you found the solution on your own just pick your answer ;).

Like the FAQs says: It's "both your privilege and duty as the person who asked the question."

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

RTS Camera movement wrong after rotation 1 Answer

Placing a Gameobject in the exact Center of the Camera? (Closed) 1 Answer

TPS Rotation Camera (similar to WoW or any other mmo) 0 Answers

First Person Camera not being child of the character/ Set child's rotation to global rotation 2 Answers

move the object where camera look 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