Posted: Sat Mar 15, 2014 11:33 pm Post subject:
Single turret with both direct fire and artillery mode?
Subject description: Solved!
I have a defensive structure that I would like to have fire in both direct and artillery fire styles. So for example from ranges 0-350 it would fire direct (like a tank), from ranges 350-600 it would fire at an arcing shot.
Ideally I would like this process to be automated, so if an enemy is in direct fire range or artillery range the defence would choose the correct firing method.
The issue that I am having is that for a single turret you can only have one 'MinimumPitch' attribute, which I could use to set a firing angle for the artillery shot.
Are there any ideas has to how I could work around this?
GDI_Jackhammer_Ortho-Side_Gun-Elevated.jpg
Description:
Artillery fire mode
Filesize:
263.19 KB
Viewed:
3171 Time(s)
GDI_Jackhammer_Final_06.jpg
Description:
Direct fire mode
Filesize:
251.59 KB
Viewed:
3171 Time(s)
Last edited by Madin on Sun Jun 11, 2017 9:35 am; edited 1 time in total QUICK_EDIT
you can create two weapons with same properties but with limited ranges. for example first one with range from 0 to 100 and second from 100 to 200
first weapon is primary weapon and second one is secondary
i dont think that is logically possible in game engine to set different pitch for one slot. so you need a trick!
the trick is to make manual animation witch will rotate pitch pivot to what degree you want.
the default model is without pitch. then you make one frame of animation
changing the pitch pivot.
ok. its simple. you need following code for animation and put it inside .w3x file.
Code:
<W3DAnimation id="TheNameOfAnimation" Hierarchy="TheNameOfYourModel" NumFrames="1" FrameRate="30">
<Channels>
<ChannelQuaternion Pivot="1" Type="Orientation" FirstFrame="0"><!--note that pivot may not be 1. you need to find it inside your model Hierarchy, find the pitch bone and set its pivot here. Quaternion Channel is for rotation-->
<Frame X="0.000000" Y="0.000000" Z="0.000000" W="1.000000"/>
</ChannelQuaternion>
</Channels>
</W3DAnimation>
to set correct xyzw for rotation follow these rules for quaternion
[w, x, y, z] = [cos(a/2), sin(a/2) * nx, sin(a/2)* ny, sin(a/2) * nz]
"a" is the angle of rotation and {nx,ny,nz} is the axis of rotation
for example bone with 50 degree rotation around X axis would be
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum