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 knuckles209cp · Oct 12, 2013 at 06:09 AM · camerarandom

randomised camera "recoil"

I want my camera to shake when my Shoot animation plays , i have working script but the camera faces straight when it plays , so if i look up and shoot the camera quickly looks straight forward then goes back to its position , Im so confused , please help me ( Oh the camera shake for my script is an animation)

Comment
Add comment · Show 7
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 MarkD · Oct 12, 2013 at 09:46 AM 0
Share

Well it is hard to help you if you don't post that specific part of the code, as I cannot see where you went in the mist with it.

As for now check whether you are rotating/moving it in Local space and not World space in your script (transform.localRotation/localPosition). local rotation will rotate based on the current rotation of the object, World will adjust it to the rotation based off the world. Also if you are using eulerAngles you will always face the same direction (wich is what you are getting), so I suspect you are using them. If so you need to step away from Euler because they are world based.

avatar image knuckles209cp · Oct 13, 2013 at 12:53 AM 0
Share

Im new to scripting and i have NO idea what you just said ... All i did was make a function called CamShake , And in that function i put animation.Play("camshake") , and it playsif my gun shoots .

avatar image DylanW · Oct 13, 2013 at 03:17 AM 0
Share

Is it possible for you to post the script so we can help you improve/fix it?

avatar image MarkD · Oct 13, 2013 at 01:56 PM 0
Share

See that is why it is smart to give a sample of your code, because I had no idea you where talking about an animation,i asumed you scripted the shaking. I see you edited your text now :).

But still without a script we can't be much of a help.

avatar image knuckles209cp · Oct 14, 2013 at 07:19 AM 0
Share

do you want the whole script or a sample? ill give you a sample

  GameObject.Find("ump").animation.Play("ShootU$$anonymous$$P");
      
      CamShake ();
 
 
 
 
 function CamShake ()  {
 
 
      GameObject.Find("$$anonymous$$ainCamera").animation.CrossFade("CameraShake");
           
 
 
 }

thats it , i'm pretty useless at transform.rotation or whatever it is , i have no idea how that works

Show more comments

1 Reply

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

Answer by AlucardJay · Oct 14, 2013 at 09:23 AM

You have probably animated the camera, so it is using world-space positions/rotations when you play the animation. Make the camera a child of an empty gameObject, then make the animation again, just animate the child camera object. Now wherever the empty gameObject containing the camera is placed, when you play the animation it should work in local-space positions/rotations (relative to the empty).

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 knuckles209cp · Oct 15, 2013 at 06:59 AM 0
Share

Ah i see how that works , ill try it now

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

Make a camera collision 1 Answer

How to make camera position relative to a specific target. 1 Answer

Switch to a random camera 1 Answer

Spawning prefab on x axis inside the camera 2 Answers

Random camera orientation 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