- Home /
 
Top-Down Game Movement Problem
Hello, i got problem in Top-Down Shooter Controller
Before i begin here is my Mouse-Look Script :
 var speed = 5.0;
  
 function Update () {
 
 var playerPlane = new Plane(Vector3.up, transform.position);
 
 var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
 
 var hitdist = 0.0;
 
 if (playerPlane.Raycast (ray, hitdist)) {
 
 var targetPoint = ray.GetPoint(hitdist);
  
 
 var targetRotation = Quaternion.LookRotation(targetPoint - transform.position);
 
 
 transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, speed * Time.deltaTime);
 }
 }
 
               And For Movement i use the Same FPSInputController But with Small Edit , I Changed :
 motor.inputMoveDirection = directionVector * transform.rotation;
 
 
               to
 motor.inputMoveDirection = directionVector;
 
               these Codes are Working Perfectly , but the problem that i want to LockCursor by Adding this Script
     if(Screen.lockCursor == true)
 
               but when i add this Code to my MouseLook not work anymore
reason : i guess because when i add the LockCursos it make cursor stuck at the middle of the screen so i cant rotate anymore..
any idea or help?
and sorry for my bad English
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Player Moves with no input 1 Answer
Change position relative to object 3 Answers
How to access a tile? 1 Answer