Author Topic: How do I restrict a turret shooting above a certain angle?  (Read 684 times)

So I've made a couple turrets lately, which work great. One problem is that I restricted their aiming arc, which also works great. The projectiles exit the barrel nicely at every angle and stuff. Except when the player aims above the barrel's tilting limit. When the player aims higher than the turret allows, the barrel stops rotating upward as it should. The projectiles however, still get spawned from the player at the angle he's looking.

There's a bone called 'mount0' at the end of the barrel. Would making the bullets come from there solve this?
If so, how do I make them come from that bone?
If it doesn't, how else can I solve this?

EDIT: The bullets seem to get spawned from the turret's eye bone.
Also here's a gif to explain my problem:
https://gyazo.com/a1fdeebb42afceb11b8dfa7751cdf677

EDIT 2: Code-wise I'd say you could just check if the up/down aim vector is above x degrees or below y degrees and just not fire a projectile if that's the case, but I have no idea how to do that.
« Last Edit: July 19, 2016, 12:05:32 AM by TheArmyGuy »


hi ill pm you on steam tmrw

hi ill pm you on steam tmrw
Or maybe post the solution here so everybody can learn?

i aim to debug the issues with him, not give him a general solution. I'll post whatever we come up with.

It's fixed thanks to reverse engineering of the tank turret dts with Port's dts importer.
The turret has a FULL look animation instead of one with limits, and is instead limited by minLookAngle = x; and maxLookAngle = y; (both in radians).
« Last Edit: July 21, 2016, 08:11:55 AM by TheArmyGuy »