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 DarkSyntaxz · Dec 28, 2012 at 11:23 AM · animationrotationdeath

Rotation after death animation problem.

I've made a system that where my players y position is initialized in the start function, and calculated that if the players y position(Falling) is greater than 8, and when the player hits the ground, then kill the player and play the "Death" animation, which is just a basic animation that rotates the players on it's Z axis. The problem is after it plays the death animation and the player spawns back at the spawn point, the player is still rotated on it's Z axis, exactly as the Death animation left it.

I have tried rotating the player back to normal the same way I made the spawn function and have looked around for answers, but nothing will work.

Here is the Death and spawn function

 public void playDeathAnimation(){
         if(isDead){
         animation.Play("Dead");
         }
     }
 
     public void spawn(){
         isDead = false;
         respawnTimer = 0;
         health = 100;
             transform.position = spawnPoint.position;
         
     }
     }

Sorry if I haven't been very specific, it sounds like a bit of a mouthful.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by alexfeature · Dec 28, 2012 at 01:06 PM

Your player object is never actually recreated. You simply reset its internal variables. So the rotation of the object is same as what it was after the animation finished.

You should also consider rotating the object back to normal after you move it back to the spawn point.

For example

 transform.rotation = spawnPoint.rotation;

This will rotate the player in the same way as your spawn point.

Hope this helps, Alex

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 Maulik2208 · Dec 28, 2012 at 01:14 PM 0
Share

$$anonymous$$ has a point here you are just resetting the position of player and that doesn't mean that your player rotation is reset.....so you first hold the value of starting rotation into a variable and at the time of respawn fetch the values from there or you can follow the line alex has pointed.......Cheers....Enjoy

avatar image DarkSyntaxz · Dec 28, 2012 at 06:51 PM 0
Share

Sorry, I wasn't very specific. I did try doing exactly that, infact it was the first thing I tried, but it didn't work

avatar image Maulik2208 · Dec 31, 2012 at 05:53 AM 0
Share

Is your problem solved?

avatar image DarkSyntaxz · Dec 31, 2012 at 11:15 AM 0
Share

No, I'm going to try and add another spawn point inside the spawn point that is smaller, and see if I can change my players rotation to that ins$$anonymous$$d.

avatar image alexfeature · Dec 31, 2012 at 01:08 PM 0
Share

Change the rotation of the spawnpoint and see if that changes your rotation.

avatar image
0

Answer by DarkSyntaxz · Jan 01, 2013 at 01:32 PM

Nothing worked, so what I did was to make another animation that flips the character back up when he spawns, and to make this invisible I will switch the players camera while he is spawning to something else and move the player to a 2nd spawnpoint where he flips up before he spawns, and changing the camera back to player view.

Thanks for your help anyway,

Brendan

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

10 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

Related Questions

Lerping smoothly between animation and new position 2 Answers

Animation problem with rotation and position. 0 Answers

Rotation Y axis is bugged. 2 Answers

Type of 3D Rotation Animation used in this video 1 Answer

Make the player go into the direction I am looking at 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