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 coffiarts · Feb 23, 2013 at 12:26 PM · animationcamerasway

Damp natural camera sway without a script - Is this possible?

Hi everybody,

Does anybody know whether there' are components or something similar that can be used to "damp" movement of a transform, i.e. without having to script that "damping" by hand?

Here's what I am trying to do:

I have a camera attached to my player model for generating the 1st person view. I've explicitely attached it to one of the bones to get immersive "camera sway".

This works very good. However, the sway is quite strong, as it translates 1:1 from the bone movement. So I want to reduce it a bit to get a more realistic, smoother feeling. Unfortunately, there's no bone in my model that behaves exactly the way that would match my expectations for the camera (there's no "camera bone", of course :)). And I wouldn't want to start changing my bone animations only for that, because that would restrict animations too much only for the purpose of getting a smoother camera.

I know that I could possibly solve this problem by some scipting, using functions like Mathf.SmoothDamp() etc. But I expect this to become quite complex, and I'd prefer not to rely on too heavy scripting for such a specific need.

That's why I am looking for a more light-weight solution (if one exists).

I've already tried to experiment with rigidbodies, but to no success.

Thanks alot!!

Comment
Add comment · Show 2
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 Owen-Reynolds · Feb 23, 2013 at 02:56 PM 0
Share

How long did you spend messing with joint components?

They act strange at first, and playing with the variables makes them even worse. But once you figure out the ranges and which kind you want (a spring joint?) they aren't that bad.

avatar image coffiarts · Feb 24, 2013 at 05:17 PM 0
Share

I tried this for about 1 hr. But I must say that I didn't get very far. I came to the conclusion that it may become quite hard to achieve what I am trying to do with joints: I tried with fixed, spring and configurable joints, but always ended up having my camera and the joined bone being "contracted" somehow. With the result that my player's spine always get's bowed down.

I admit that I finally went over trying the scripting approach proposed by steinbitglis below, and this solved my problem much easier. I suppose that joints aren't a bad idea at all, but in my case (maybe only by chance) the other solution turned out to be more suitable.

Thanks anyway! Your hint drew my attention to joints, and I am sure that I'll use them anyway before long.

1 Reply

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

Answer by steinbitglis · Feb 23, 2013 at 08:38 PM

You could try to make your camera read the position and rotation from where it is now, but not actually be a child transform.

Something like this:

 class DampedTransform (MonoBehaviour):
 
     public target as Transform
     public tightness = 1f
 
     def Update ():
         transform.position = Vector3.Lerp(target.position, transform.position, Mathf.Pow(0.98f, Time.deltaTime * 60f * tightness))
         transform.rotation = Quaternion.Slerp(target.rotation, transform.rotation, Mathf.Pow(0.98f, Time.deltaTime * 60f * tightness))
 
Comment
Add comment · Show 2 · 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 coffiarts · Feb 24, 2013 at 05:19 PM 1
Share

Thanks, steinbitglis! I managed to solve my issue with your suggestion.

In my case, the only slight difference was that I still had to attach my camera to the player root object (as a child), to ensure that it neatly moves together with it.

Then I created a script like described above and set the *eye bone" as the target.

Apart from some picky details that I had to elaborate (no sense in posting them here) it basically worked!

thumbsup

avatar image coffiarts · May 21, 2013 at 01:34 PM 0
Share

Sorry for taking so long to accept your answer! I wasn't aware that I had only hit the "vote up" button. Now I've noticed - better late than never! :)

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

12 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

Related Questions

End of Animation 1 Answer

How do i know if a animation is finished or not ? 2 Answers

Play from a variety of sounds? 1 Answer

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

Gun clipping through walls in third person shooter 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