[SOLVED]Turret Behaviour ..Arc Limit?

Get help using Construct 2

Post » Sun Feb 03, 2013 7:57 pm

Im trying to limit the rotation of the turret to a given arc, say +- 60 degrees (set with an instance var). Additionally, the turret is pinned to another object that can also move and rotate freely. Im still not comfortable with C2, so any help would be greatly appreciated :)matt752013-05-05 09:55:14
B
6
G
2
Posts: 37
Reputation: 1,499

Post » Mon Feb 04, 2013 6:30 pm

anybody? :/
B
6
G
2
Posts: 37
Reputation: 1,499

Post » Mon Mar 11, 2013 7:28 am

I added limited fields of fire to a Podpathos capx:

Limited Field of Fire Turrets

- orig did not use turret behavior at all.
- it now uses turret behavior for acquiring target that is in range, predictive aim, triggering the shot, etc.
- the turret behavior auto rotate feature is disabled and angle of turret is rotated back inside the limit, or back to the base turret orientation whenever it hits the field of fire limit, or when there is no current target.Jaycephus2013-03-11 22:31:03
B
14
S
4
G
1
Posts: 26
Reputation: 1,747

Post » Mon Mar 11, 2013 10:29 pm


Updated with some info graphics:
(updated again to show what one turret with Predictive Aim off does... and added field of fire indicators when selecting a turret.)

Turrets - Limited Fields of FireJaycephus2013-03-13 16:03:47
B
14
S
4
G
1
Posts: 26
Reputation: 1,747

Post » Tue Mar 12, 2013 1:21 am

@Jaycephus - nice example cheers
B
31
S
8
G
5
Posts: 436
Reputation: 5,836

Post » Tue Mar 12, 2013 5:51 am

Thanks! Should have mentioned above to click on the turrets to see the info and range graphic.
B
14
S
4
G
1
Posts: 26
Reputation: 1,747

Post » Tue Mar 12, 2013 7:58 pm

@Jaycephus Thanks for your solution.
B
70
S
11
G
6
Posts: 18
Reputation: 9,152

Post » Wed Mar 13, 2013 4:33 pm

You're welcome. I needed the feature myself, so I searched and found a Podpathos capx that demonstrated limited fields of fire, but implemented the turret directly in events rather than using the behavior. I wanted to have predictive aim, firing rate, etc, from the behavior, so I modified it to use the behavior and still limit the field of fire.

To demonstrate the effect of turning Predictive Aim off, I updated the latest version of the capx above to set Predictive Aim off on the third turret from the left. For this pattern of targets, and the velocities involved, it never hits a target, ever. I also added field of fire indicators to the range indicator when you click on a turret.

I think limited fields of fire is the only really needed thing missing from the turret behavior. Perhaps an option to limit the detection area to the limited field of fire as well. Also, having a detection range that is longer than firing range might be nice, since you can almost always see the target before it is in range. But that can easily be implemented in this capx by simply setting the bullet.range at time of spawn to something like turret.range * 0.5, and then doubling the turret range. The problem of detecting enemies behind turret, outside of the field of fire, would still remain, and be made worse as well. This is bad because the turret locks on to the first target in range in my preferred targeting mode. So for some time it may be unable to fire on the current target, while other targets pass within its field of fire. The solution is probably to monitor the diffangle and distance to the target, and as long the current target is out of range of the actual bullets, force it to unacquire the target (a feature of the behavior), say once a second. Then the turret will re-pick the nearest target, which could be the same target somewhere behind it or out of bullet.range, but at least there is a chance it will re-target something in front of it that is in range. The downside to not permitting the turret to target beyond the field of fire and range of its bullets is that you lose the opportunity to pre-rotate toward the target, which allows it to get more bullets on the target depending on the circumstances. I think most games just allow the turrets to rotate really fast to solve that issue.
B
14
S
4
G
1
Posts: 26
Reputation: 1,747

Post » Sun May 05, 2013 9:53 am

oops!, have been on in a while. thanks :). I did create a solution but it was long winded and ugly. It involved using a placeholder node, an invisible node that is parented to object you want the turret pinned to.. this represented the original orientation of the turret, and through an instance variable i could arc limit based on the angle between the target and this invisible node.. and rotate the turret to match this nodes orientation when the target was lost.. my construct skills are shockingly bad.. but anyway, thanks for your help :)
B
6
G
2
Posts: 37
Reputation: 1,499


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests