I’m attempting to have it so when I scroll up and down, it will push or pull a ball when the player controller is near it. The problem I’m having is that it is working all the time whether or not I’m in the trigger area which is attached to the ball. What’s weirder is that When I had it set to be done using left click to push and right click to pull it worked as intended, but then i switched it to the scroll wheel and the trigger stopped working. Here’s the full script:
public GameObject Ball;
public GameObject Camera;
public GameObject Body;
private Transform Force;
public float PushPower = 1;
public float PullPower = -1;
void SetinitialReferences()
{
Force = transform;
}
void OnTriggerStay()
{
if (Input.GetAxis("Mouse ScrollWheel") > 0f) Ball.GetComponent<Rigidbody>().AddForce(Body.transform.forward * PushPower, ForceMode.Impulse);
if (Input.GetAxis("Mouse ScrollWheel") < 0f) Ball.GetComponent<Rigidbody>().AddForce(Body.transform.forward * PullPower, ForceMode.Impulse);
}
Any Help? Thanks in Advance! ![]()
