- Home /
how can i get controller aim similar to JB Goldeneye /Timesplitters/ old Perfect Dark,controller aim similar to golden eye/ TimeSplitters and old Perfect dark for fps
hello im making a fps style game and would like to have analog stick aim controls similar to JB Golden Eye on Nintendo 64, where its more of a spring mouse in the middle of the sticks range and then as you push the stick towards the outer edges it becomes more like modern cod style stick aim.
i have been able to sort of do it with the script below but its really jumpy when it switches from spring to normal and jumps back and forward and just seems a bad way to do it.
could anyone give me a example or point me in the right direction
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class ControllerAim : MonoBehaviour { float deadzone = 0.25f; float gg; float RX = 0; float SpringDist = 50; bool CanUpdate;
void Update()
{
if (CanUpdate)
{
gg = transform.rotation.eulerAngles.y;
}
RX += Input.GetAxis("RightStickX");
Debug.Log("rr" + gg);
if(Mathf.Abs(Input.GetAxis("RightStickX")) < deadzone)
{
CanUpdate = false;
transform.rotation = Quaternion.Euler(0, gg + Input.GetAxis("RightStickX") * SpringDist, 0);
}
else
{
CanUpdate = true;
transform.rotation = Quaternion.Euler(0, RX, 0);
}
}
}
Your answer
Follow this Question
Related Questions
Player keeps falling through the floor and I'm really stuck 5 Answers
Topdown player movement with controller problem 1 Answer
Need help to make the camara rotation follow the player 0 Answers
Make Animation Play After Boolean is Set to True? 2 Answers
Stop and object from moving faster after a specific speed is reached? 2 Answers