Is there an easy way to check if a missile that hasn't been armed yet (the stage where you fire it but it basically bounces off stuff) has collided with something?
[...]
lol, this is brilliant. well, it works well enough, and checking if angular velocity is like 5 is enough to trigger reliably. Thanks!
I believe the angular velocity is in degrees/second, so 5°/s is actually not very much. I'd say somewhere around 90-180 starts counting as very high.
Not sure, sorry!
I might have to get an IDE running on my Windows machine then...
Thanks anyways =)
ship.getMutableStats().getAutofireAimAccuracy().getModifiedValue()
Range is something like -0.5 to 1.
1f means aim at the correct predicted point. 0 means assume shots are twice as fast as they actually are, so, lag behind the target a bit.
Of note: the vanilla autofire AI will improve its aim with time spent firing on the same target.
Awesome, that helps a lot! Thanks!
So, essentially,
virtualProjectileSpeed = actualProjectileSpeed * (2-targetLeading)
I might use
virtualProjectileSpeed = actualProjectileSpeed * (1.5 - targetLeading/2)
though, as my AIs are specific Fighters-Only and Missile-Only AIs and I feel like it makes sense that if your gunners only have to focus on one type of target they'll do a slightly better job at it.
Funnily enough, I hadn't even though of heavily encouraging weapons to stick to the same target. Turns out, when you do, weapons spend a lot less time erratically turning around and a lot more time actually firing xD
Hmm - are you mixing up acceleration and speed, maybe? The acceleration is a fixed value. The speed has a current and maximum value. Well, the speed doesn't really have a current value, the velocity does...
Ok, I guess I was just thinking too complicated xD
In "real world" physics, acceleration is the time-derivative of the velocity (in the same way that the velocity is the time derivative of the location) and thus a variable vector. But I agree, that's probably overkill for a (non-racing) game engine.
But that still answers my question: I think I simply won't include the acceleration into my target leading calculations xD
Thanks a bunch for all your answers! That certainly did help!
Edit: I pulled a sneaky edit on my post