So I'm aware of and have used the whole Weapon Direction thing, how you can control which direction an attack cone is. But I've run into another problem.
Basically, my turret that I want to be able to swivel 360 degrees is pointing behind the unit when in default mode. But when I tell it to shoot, it turns the opposite direction, barrels pointing away from target. How can I get this to aim properly and keep my turret pointing backwards by default?
Gun Direction
Moderator: Moderators
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
Re: Gun Direction
Invert the heading in the aiming script (in the 'turn' command that aims the turn, tell it turn to (0 - heading) instead of just heading)
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Gun Direction
Code: Select all
function script.AimWeapon1( heading, pitch )
Signal(SIG_AIM)
SetSignalMask(SIG_AIM)
Turn(flakturret, y_axis, (0 - heading), math.rad(90))
Turn(barrel, x_axis, -pitch, math.rad(50))
WaitForTurn(flakturret, y_axis)
WaitForTurn(barrel, x_axis)
StartThread(RestoreAfterDelay)
return true
end
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
Re: Gun Direction
Well, it's getting closer at least. Try 90 - heading or 90 + heading (if one fails, try the other), depends whether it's off 90 degrees clockwise or anticlockwise.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Gun Direction
Hmm, okay. This won't create any wonky side-effects will it?
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: Gun Direction
I would turn the barrel forward on the model, and turn it backwards in Create() and RestoreAfterDelay().
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Gun Direction
The wonky side effect was created when you did it rong in upspring.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Gun Direction
I don't see any problem with wanting a turret to be pointing backwards.
That sounds like a pretty good fix Zerggin, I'll give that a try.
That sounds like a pretty good fix Zerggin, I'll give that a try.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Gun Direction
It would be the y orientation of your turret.
If you rotated the base and then neglected to hit "Apply Transform" that would explain a lot. If you wanna post up your model, I'll maek fixie.
It's not really good to have to fix a model with scripting. It's better that the model is right in the first place.
If you rotated the base and then neglected to hit "Apply Transform" that would explain a lot. If you wanna post up your model, I'll maek fixie.
It's not really good to have to fix a model with scripting. It's better that the model is right in the first place.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Gun Direction
I agree. Here's the model and texture, just so it's easier to see what's going on. The turret now is pointing to the back of the unit.Forboding Angel wrote:It's not really good to have to fix a model with scripting. It's better that the model is right in the first place.
- Attachments
-
- AA Truck.rar
- AA Truck
- (94.86 KiB) Downloaded 11 times