how to convert a Vector3 to a float value?
Basically I'm trying to manipulate the Transform.rotation.z component using Input.mousePosition to accomplish rotation of the sprite to face the direction of the mouse curser. I've tried using (more like misusing) Quaternion commands, but they confuse me so I've probably just been skipping right over the answer by mistake lol. Any advice is greatly appreciated. Thank you.
Answer by mahdiii · Mar 04, 2016 at 08:06 AM
use Camera.ScreenToWorldPoint(Input.mpuseposition) to convert screen point to world point and then subtract this from transform.position of the sprite. So you have a Vector3 "vv" and can change the transform.up or transform.right of the sprite transform.up=vv.normalized; You can use transform.LookAt as well.
Your answer
Follow this Question
Related Questions
Quaternion rotation issue please help :'( 0 Answers
How to use Quaternion.Slerp with transform.LookAt? 3 Answers
Why isn't my steering wheel working? 0 Answers
Using quaternions to align game objects. 1 Answer
3 Axis Camera Rotation 0 Answers