UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionAdjusting Camera Sensitivity through GUI.HorizontalSlider (c#) EmptyAdjusting Camera Sensitivity through GUI.HorizontalSlider (c#)

more_horiz
I want to make a simple mouse sensitivity slider but i dunno how to start. Can anyone help me fix this please? Do i have to access the "publicfloat mousesensitivity = 5.0f;"? if so can anyone help me Thanks again! Also if possible can you guys provide the editted code as a whole kinda sorta still a noob sorry...

Controller script:

Code:


using UnityEngine;
 using System.Collections;
 
 public class Controller : MonoBehaviour {
 
     public float movementspeed = 5.0f;
     public float mousesensitivity = 5.0f;
     public float jumpspeed = 20.0f;
 
     float  verticalRotation = 0;
     public float updownrange = 60.0f;
 
     float VerticalVelocity = 0;
 
     // Use this for initialization
     void Start () {
         Screen.lockCursor = false;
     }
    
     // Update is called once per frame
        
         void Update () {
             CharacterController cc = GetComponent <CharacterController> ();
 
     //Rotation
         float rotleftright = Input.GetAxis("Mouse X") * mousesensitivity;
             transform.Rotate (0, rotleftright, 0);
 
         verticalRotation -= Input.GetAxisRaw("Mouse Y") * mousesensitivity;
             verticalRotation = Mathf.Clamp (verticalRotation,-updownrange ,updownrange);
                 Camera.main.transform.localRotation = Quaternion.Euler (verticalRotation, 0, 0);
 
 
     //Movement
 
 
         float forwardspeed = Input.GetAxis("Vertical") * movementspeed ;
         float sidespeed = Input.GetAxis("Horizontal") * movementspeed ;
 
         VerticalVelocity += Physics.gravity.y * Time.deltaTime;
 
 
         Vector3 speed = new Vector3 (sidespeed, VerticalVelocity , forwardspeed );
 
         speed = transform.rotation * speed;
 
    
 
         cc.Move ( speed * Time.deltaTime );
     }
 }


Slider Script:

Code:


using UnityEngine;
   using System.Collections;

    public class HSlider : MonoBehaviour {
    float hSliderValue = 5.0f;
    // Use this for initialization
    void Start () {
 
    }
 
    // Update is called once per frame
    void Update () {
 
    }
    OnGUI {
        Rect slider = new Rect (50, 30, 100, 30);
        hSliderValue = GUI.HorizontalSlider(slider,hSliderValue,1.0f,100.0f);
    }
 
}    

descriptionAdjusting Camera Sensitivity through GUI.HorizontalSlider (c#) EmptyRe: Adjusting Camera Sensitivity through GUI.HorizontalSlider (c#)

more_horiz
Hello

We see that you have some issues with your project/script, however we can help you for a price. If you would like us to work for you then please feel free to contact us at http://RenntekStudios.co.uk or on Skype at RenntekStudios thanks

Our prices are very cheap. Little errors we can fix for free, otherwise projects we can discuss prices. Hope you get in touch shortly thank you...
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply