For my new game, Vehicle Battlefield re-make, I’m trying to add full controller support, but it REALLY isn’t working.
The problem isn’t actually with the controller behaviors, it’s with the point-at behavior. I have a set of globals (X & Y) that the turret on the tank is supposed to point at, but the glabals are being annoying and I can’t seem to find the problem. Here’s the code:
This code clearly doesn’t make the gun point towards the cursor object.
Does anyone know why? I think I might’ve made a help request on the same topic a while back, but I don’t quite remember how it was fixed, so here I am again.
The cursor is in the User Interface.
The issue is improperly showcased and the description doesn’t clearly describe what’s actually happening. So the cursor does work perfectly fine, however it stops working when controller is connected because the Cursor X/Y Globals are different than what the MouseMove behavior is actually outputting. You can very easily see this just by running the code as the game is running.
I’m not using a controller however, so that other part of the code you showed isn’t activated. I’m just assuming this is the issue.
So the issues are;
The Globals aren’t the same as the X/Y from the MouseMove. I have no idea what code is setting the Globals, but that should be a very simple fix.
Why do you even care about the Cursor if you’re using controller? It makes absolutely no sense to have any code for that.
The turret should be controlled by R-Stick, not by the cursor.
Finding that angle is very easy to do, just use the bundle JR made for his controller example. It’s simple, easy, and works.
Yeah, so I’m saying you have no issue.
Everything is working as it’s meant to, unless you’re saying with controller it’s not pointing towards where you angle, but I didn’t see any code for that.
Ok you didn’t describe your problem well enough at all before, I could not tell at all that you’re just trying to get controller to aim. That’s what you’re trying to do, right?
Yep. I have the left stick move the reticle and the gun needs to point towards it. I have two ways to do this in mind:
1: Have the reticle control the gun.
2: Have the gun control the reticle.
I tried to make the first idea, but it isn’t working, that’s why I made this help request. Sorry for not explaining it like this earlier.