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
2
Question by thedavross · May 16, 2013 at 12:24 PM · rotationcharactercontrollerbonesmouse-look

Character Mouse Look on Spine

I Have a Character that i want to apply the mouse look script to his spine to make him look up and down(bending over, leaning back) if i add an empty gameObject and place all cord,rotation to zero and place the spine inside i can achieve this but then the animation wont play above the spine with AddMixingTransform, How do i get the spine to act like the empty gameObject zeroed out retaining the animations yet allowing the mouse to look up and down. Do I rotate his spine some how with script? I have searched all over and cant seem to find what to do. I would much appreciate any help and advise on this please.

Comment
Add comment · Show 4
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 ExTheSea · May 16, 2013 at 04:07 PM 0
Share

I had a similar problem. $$anonymous$$y animations also didn't play but the reason for that was that I destroyed the Bone-Hirarchy by adding the empty Gameobject. $$anonymous$$aybe it's a similar Problem. What I did was adding the $$anonymous$$ouseLook-Script directly to the spine-Bone and then changing the script a little bit because i had some weird rotation problems.

The Script I ended up using was this: https://dl.dropboxusercontent.com/u/83937500/$$anonymous$$ouseLookBones.cs

If you're trying to use it watch out. There are parts of networking + Recoil in the script. Just comment out what is blocking and maybe change if your model acts differently. Btw. In the Inspecter you have to choose $$anonymous$$ouseX.

Report back if you try it.

avatar image thedavross · May 16, 2013 at 04:54 PM 0
Share

$$anonymous$$any thx ExTheSea I will certainly give this a try and report back once i have again cheers for the reply

avatar image thedavross · May 18, 2013 at 11:55 AM 0
Share

I have managed to give this a quick test and although not fully working it allows me to move the spine now and retain the animation which currently didn't work but i'm getting what appears to be a rotation issue as the character flicks back and forth once i start to lean forward.I am a bit of a noob and will probably have to do some more reading on this. I currently have Root>Spine>Hip on the character and each has a rotation on the x axis. root = 90d, Spine = 270d and the hip which is the one i want to rotate is 90d so i guess its to do with the 90d on this bone as to why its trying to re-position. Thanks for sharing this i guess i now have to try understand how go about correcting this but i guess im a step closer....cheers

avatar image ExTheSea · May 18, 2013 at 12:04 PM 0
Share

If it helps here is my question from the time where i had this problem. http://answers.unity3d.com/questions/334526/animation-interfears-player-movement.html

I can't quite remember what i finally did to solve my problem. It might have even been inside blender, not unity.

2 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by 03gramat · Oct 08, 2013 at 02:10 PM

In case you have not resolved this issue, or for anyone else that has a similar problem to you (or me)

Although I made my model in 3DS max, I expect this to work similarly for you. I attached an adaptation of the mouselook script to the 2nd of my 3 spine segments (it seemed to work best for the way the back bending looked). I changed it to JS from c# but it is pretty easy to convert. My solution was base on the fact that the update needs to be changed to a Late one and also the angle of rotation needs to be on the Z axis because of the orientation of the spine:

     var sensitivityZ = 15F;
 
     var minimumZ = -60F;
     var maximumZ = 60F;
 
     var rotationZ = 0F;
 
     function LateUpdate ()
     {
 
             rotationZ += Input.GetAxis("Mouse Y") * sensitivityZ;
             rotationZ = Mathf.Clamp (rotationZ, minimumZ, maximumZ);
             
             transform.localEulerAngles = new Vector3(0, transform.localEulerAngles.y,rotationZ);
         
     }
     
     function Start ()
     {
         // Make the rigid body not change rotation
         if (rigidbody)
             rigidbody.freezeRotation = true;
     }
Comment
Add comment · 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 felixfors · Feb 07, 2014 at 08:59 AM 0
Share

wow thank you so much! I have been looking for something like this forever, it work exactly like I want it except a small litle thing. I added the script to my main torso bone that controls the whole upper body and when I press play it rotates the whole torso 90 degrees to the right. why? : s I have tried to rotate the torso before going to to playmode 90 degrees at the other direction in hope that it would then rotate the character to the normal position at play but it still goes to the same direction as earlier. It seems like it only want to face 90 degrees on the Y axis all the time.

EDIT: I fixed it by changing the rotations on my bone to 0 in all directions, Thank you so much for the script! :D

avatar image johndii1491 · Oct 12, 2014 at 09:08 AM 0
Share

How to make my characters torso move in the x-axis rather than the z-axis?

avatar image johndii1491 · Oct 12, 2014 at 09:46 AM 0
Share

never $$anonymous$$d I figured it out hahahah

avatar image ownerfate · Mar 23, 2015 at 01:28 AM 0
Share

Thanks 03gramat, that is also something i have been looking for, for an extremely long time

avatar image me2000 · Jan 27, 2016 at 08:12 PM 0
Share

How do you use Y axis ins$$anonymous$$d of Z? I changed everything from ...Z to Y but it does not change the axis ffs

avatar image
0

Answer by Ectoo · Aug 30, 2016 at 02:01 PM

@me2000

To get the Z axis you need to edit Input.GetAxis ("Mouse Y" ); to Input.GetAxis("Mouse X");

unity .GetAxis runs off x & y not y & z, The link down below can help.

https://docs.unity3d.com/ScriptReference/Input.GetAxis.html

Comment
Add comment · 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

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

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

CharacterController "breaks" collision, goes haywire 2 Answers

CharacterController doesn't rotate on my script... 1 Answer

How to make Main Camera shake correctly when getting attacked? 1 Answer

Bone movement by scripting using given angle as input. 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