Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Animation AimUp & AimDown with the Mouse ?

$
0
0
help a beginner of a fps .... why only 1 animation works =? function Start() { // First set both animations layer value to something different to each other. This allows you to play them both at the same time. animation["aim"].layer = 1; animation["dodge"].layer = 2; // Second set both their speed to 0. animation["aim"].speed = 0; animation["dodge"].speed = 0; // Thirdly play both the animations animation.Play("aim"); animation.Play("dodge"); } // Use the mouse input to set the normalized time of the animations to what you want. Something like this. var maxMouse : float = 366; function Update() { var newTimeAim : float = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.y)) / maxMouse; var newTimDodge : float = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.x)) / maxMouse; animation["aim"].normalizedTime = newTimeAim ; animation["dodge"].normalizedTime = newTimDodge ; }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>