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
-1
Question by pwnisher · Oct 04, 2012 at 07:38 PM · animation3dflashlight

Animation flashlight when run

Hi guys, i want to know how i can make an animation and when i press shift for run the flashlight turn down, when i unpress shift the flashlight come up again

like all fps games..

Thanks a lot

Comment
Add comment · Show 1
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 ThePunisher · Oct 04, 2012 at 10:09 PM 0
Share

You need to be more specific. What is it that you want to know / are having problems with? Input? Animations? Lighting?

4 Replies

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

Answer by victorafael.com · Oct 05, 2012 at 12:03 AM

You can have the flashlight down on the animation (or make it parent to the hand bone) like:

flashlight.parent = handBone;

Or you can do the weird way and store the default flashlight rotation on a quaternion and on another store the value for running, and when the user press Shift, navigate from first value to second using Quaternion.lerp

 //On variables definition
 
 Quaternion startRotation;
 Quaternion runningRotation;
 
 float changeTime;
 
 ....
 
 //On Start Run function:
 running = true;
 changeTime = Time.time
 
 //On Stop Running function
 running = false;
 changeTime = Time.time;
 
 //On Update Method 
 if(running){
    if(Time.time < changeTime + 1){
       flashlight.rotation = Quaternion.lerp(startRotation,runningRotation,Time.time - changeTime);
    }else{
       flashlight.rotation = runningRotation;
    }
 }else{
    if(Time.time < changeTime + 1){
       flashlight.rotation = Quaternion.lerp(runningRotation,startRotation,Time.time - changeTime);
    }else{
       flashlight.rotation = startRotation;
    }
 }
 
 
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
avatar image
0

Answer by hvilela · Oct 04, 2012 at 09:14 PM

Add a spot light to your character. Enable/disable it at the shift key press.

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
avatar image
0

Answer by MibZ · Oct 04, 2012 at 09:33 PM

You answered your own question - to make an animation where the flashlight points at the ground while you are running you need to make an animation where the flashlight points at the ground.

If you had an animated character with a run animation all you have to do to accomplish this is attach the light GameObject to the gun GameObject and it will always point where the gun points.

If you are looking for a recommendation for an animation program, I would recommend Cinema 4D - it is easy to learn the basics and it has a free trial that allows saving and exporting.

The best way to learn animation is to look up some tutorials, follow along with them, and once you feel like you have a basic understanding of how to use the program start trying to make your own creations without a tutorial.

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
avatar image
0

Answer by AlucardJay · Oct 05, 2012 at 03:53 AM

soulblade has very kindly donated their script :

http://answers.unity3d.com/questions/323129/if-anyones-looking-for-a-flashlight-script-with-a.html

There are many many answers to that on this 'site alone :

http://www.lmgtfy.com/?q=unity+flashlight

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

13 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

Related Questions

How to make Flashlight timer. 1 Answer

Trying to simply play this animation... Help please. 1 Answer

Reacting to Mouse animation... 2 Answers

Loop animation on button hold 2 Answers

How could it be done "Cooldown" for a shield ? 2 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