Hi there,
I basically have a character controller with a custom motor script. I'm new to Unity and am finding it very splintered compared to other engines but am required to use it for a university assignment. For my assignment I intend to create a 2.5D side-scroller as it will be achievable in the time span given by the uni. Everything was going swimmingly until I had to 'AddAnimationMix' some bones (stop them from animating so that they can become manipulated) and set it to track the mouse. I have googled and searched the crap out of the unity help forums but I am still to no fix. Does anybody know an assured 'script' to bone [gameObject] method so I can carry on with developing the character controls?
p.s I'm using Javascript script
Thanks!
Replies
Hope this works.
localRotation takes Quaternions, and not euler (xyz) angles, so you'll want to use
edit: Wow I'm retarded... can easily set the mouse co-ordinate back to screen boundary if it crosses.
Just attach this to the bone in your skinned mesh and it'l track the angle and rotate to face the mouse. (This also feeds into a Globals script that conditions the player's facing direction depending on whether the mouseX is greater than the players position on the screen. This effects the above smoothness of rotation. Side Scroller only but could be adapted to other types of play.)