:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::
Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Mon Dec 11, 2017 9:17 am
All times are UTC + 0
 Forum index » Modding Central » Command & Conquer 3 Editing Forum
Single turret with both direct fire and artillery mode?
Moderators: Global Moderators
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Madin
Cyborg Cannon


Joined: 05 Apr 2009

PostPosted: Sat Mar 15, 2014 11:33 pm    Post subject:   Single turret with both direct fire and artillery mode?
Subject description: Solved!
Reply with quote

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:  1691 Time(s)

GDI_Jackhammer_Ortho-Side_Gun-Elevated.jpg



GDI_Jackhammer_Final_06.jpg
 Description:
Direct fire mode
 Filesize:  251.59 KB
 Viewed:  1691 Time(s)

GDI_Jackhammer_Final_06.jpg



Last edited by Madin on Sun Jun 11, 2017 9:35 am; edited 1 time in total

Back to top
View user's profile Send private message
Beethoven
Vehicle Driver


Joined: 05 May 2015

PostPosted: Tue May 05, 2015 12:38 pm    Post subject: Reply with quote

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.

also you need following code for your model draw

Code:

            <AnimationState
               ParseCondStateType="PARSE_NORMAL"
               ConditionsYes="USING_WEAPON_A FIRING_OR_PREATTACK_A">
               <Animation
                  AnimationName="AnimationPitchDegree0"
                  AnimationMode="MANUAL"
                  AnimationBlendTime="50"/>
            </AnimationState>
            <AnimationState
               ParseCondStateType="PARSE_NORMAL"
               ConditionsYes="USING_WEAPON_B FIRING_OR_PREATTACK_B">
               <Animation
                  AnimationName="AnimationPitchDegree50"
                  AnimationMode="MANUAL"
                  AnimationBlendTime="50"/>
            </AnimationState>


here animation blend time is alternative for your pitch speed.less means faster. so 0 will result immediate transformation

note that two animations have only one frame. game engine will handle how to merge this animations! with help of AnimationBlendTime.

and these are weapons and turret


Code:

               <WeaponLaunchBone WeaponSlotID="1" WeaponSlotType="PRIMARY_WEAPON" BoneName="bone" />
               <WeaponLaunchBone WeaponSlotID="1" WeaponSlotType="SECONDARY_WEAPON" BoneName="bone"/>
                                        <Turret TurretNameKey="turretbone" TurretID="1" />


so pitch finally is controlled by animations! Cool

Edit: how to make this animation?

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
Code:
<Frame X="0.422618" Y="0.000000" Z="0.000000" W="0.906307"/>


if pivot is parent of another pivot rotation would not be that simple and you need to do it in 3dmax.

Back to top
View user's profile Send private message
Madin
Cyborg Cannon


Joined: 05 Apr 2009

PostPosted: Wed May 20, 2015 9:49 pm    Post subject: Reply with quote

This is very interesting, thanks!
_________________

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
 Forum index » Modding Central » Command & Conquer 3 Editing Forum
Jump to:  
Quick Reply
Username:


If you are visually impaired or cannot otherwise play the game below please contact the Administrator for help.


 
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


Powered by phpBB © phpBB Group

Wildcard SSL Certificates
[ Time: 0.1064s ][ Queries: 15 (0.0047s) ][ Debug on ]