Relative position (enemy AI related... kinda)
Okysho
Member Posts: 158
I'm almost done with all of the game mechanics for my game (beta named Deadly Sin, for reference ease).
one of my enemies flies around, generally hovering around the player and fires at the player from the air. Since it's constantly moving, I can't make it strafe and blindly fire, so I incorporated a "move-to" action, but this is a bit to precise, making the enemy's shot completely unavoidable.
I've considered using a timer to change the player position attribute instead of constrain, but if that changes halfway through the enemy's AI, the shot might turn around in mid-air and it looks all silly and unnatural.
Does the community have any suggestions as to how I can have my enemy shoot at my player, but shoot at it's relative position, rather than homing in on it's exact position?
In advance, thanks!!
one of my enemies flies around, generally hovering around the player and fires at the player from the air. Since it's constantly moving, I can't make it strafe and blindly fire, so I incorporated a "move-to" action, but this is a bit to precise, making the enemy's shot completely unavoidable.
I've considered using a timer to change the player position attribute instead of constrain, but if that changes halfway through the enemy's AI, the shot might turn around in mid-air and it looks all silly and unnatural.
Does the community have any suggestions as to how I can have my enemy shoot at my player, but shoot at it's relative position, rather than homing in on it's exact position?
In advance, thanks!!
Comments
This is actually how some 3D shooters do it as well when tracing a line towards the player. It's probably not the best but it works fairly well if you can get the numbers around the random call working right.
Things to take into effect would be the size of the player actor, the current angle and distance between the player and the enemy, the speed at which both actors move...
I am hoping that one day I can write a tutorial or two on this topic but right now I am full ahead on 'real' work.