Creating a better targeting system for starfighter-blasters
Moderator: Moderators
-
- Private First Class
- Posts: 80
- Joined: Thu Sep 01, 2016 3:41 pm
- Projects :: Tatooine - Jundland Wastes
- xbox live or psn: No gamertag set
Creating a better targeting system for starfighter-blasters
Hello, I've been thinking about adding in a way of using starfighter-blasters that's much easier to use and way closer to how it is in-universe; what I mean is, I want to make starfighter blasters lock onto targets and fire in the direction of the locked-onto-fighter. This would allow people to make gunning-runs without having to point their fighter straight towards whatever they want to shoot, which can be suicidal if done on infantry. Is there any way to do this? My main problem is finding a way to offset the laser's firing direction based on where the targeting reticle is facing.
-
- First Lance Corporal
- Posts: 123
- Joined: Sun Jul 05, 2015 5:07 pm
- Projects :: BF2 Refresh Mod
- xbox live or psn: VaporousFern310
- Location: California, USA
Re: Creating a better targeting system for starfighter-blast
The best I've been able to come up with is a sort of missile launcher with auto-lock, where the ordnance (a missile) has a minimum speed of 0 and then accelerates to a laser-like speed (say, 2000m/s) in a very short time (say, 0.1s). The missile has a turn rate that will allow it to change direction whilst accelerating, but will be negligible at velocity. I moved on to another mod before I found the motivation to polish it up and make it look more convincing.
Hidden/Spoiler:
-
- Private First Class
- Posts: 80
- Joined: Thu Sep 01, 2016 3:41 pm
- Projects :: Tatooine - Jundland Wastes
- xbox live or psn: No gamertag set
Re: Creating a better targeting system for starfighter-blast
The other idea I had was to offset the laser's direction in the same way the Wookiee Bowcaster does, then use Lua's SetProperty to change that ODF parameter based on what the currently locked-on target's position would be. However, I don't know of any way to hook into the event of a laser firing, especially early enough that I can change the direction it fires in.Samee3 wrote:The best I've been able to come up with is a sort of missile launcher with auto-lock, where the ordnance (a missile) has a minimum speed of 0 and then accelerates to a laser-like speed (say, 2000m/s) in a very short time (say, 0.1s). The missile has a turn rate that will allow it to change direction whilst accelerating, but will be negligible at velocity. I moved on to another mod before I found the motivation to polish it up and make it look more convincing.Hidden/Spoiler:
-
- First Lance Corporal
- Posts: 123
- Joined: Sun Jul 05, 2015 5:07 pm
- Projects :: BF2 Refresh Mod
- xbox live or psn: VaporousFern310
- Location: California, USA
Re: Creating a better targeting system for starfighter-blast
List of LUA functions
It sounds like it would be a matter of getting the position/rotation of both the target and the weapon, and calculating an offset from that.
I've been relatively satisfied with the way my targeting system turned out, but I'm curious if you can come up with anything.
It sounds like it would be a matter of getting the position/rotation of both the target and the weapon, and calculating an offset from that.
I've been relatively satisfied with the way my targeting system turned out, but I'm curious if you can come up with anything.
-
- Private First Class
- Posts: 80
- Joined: Thu Sep 01, 2016 3:41 pm
- Projects :: Tatooine - Jundland Wastes
- xbox live or psn: No gamertag set
Re: Creating a better targeting system for starfighter-blast
One thing I did notice was that, to keep the blasters centred, starfighters like the A-Wing will slightly point their cannons inward as you get closer to a target/the ground. As well, AI can actually fire their blasters in different directions while flying. So, the code for switching the direction the blasters are facing exists. The problem is accessing it.Samee3 wrote:List of LUA functions
It sounds like it would be a matter of getting the position/rotation of both the target and the weapon, and calculating an offset from that.
I've been relatively satisfied with the way my targeting system turned out, but I'm curious if you can come up with anything.
Edit: GetWorldPosition(unit) is apparently a thing. Anyone know about doing stuff when lasers are fired/getting the locked-on target of a unit?
Edit2: Oh wait, goddamn! I could use an ObjectCreate callback in Lua; that way I can hook into the creation of a blaster bolt! Hell yeah, I might get somewhere now.