Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Thu Mar 28, 2024 3:58 pm
All times are UTC + 0
Single turret with both direct fire and artillery mode?
Moderators: Global Moderators
Post new topic   Reply to topic Page 1 of 1 [3 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
Madin
Plasma Trooper


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  Mark this post and the followings unread

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

GDI_Jackhammer_Ortho-Side_Gun-Elevated.jpg



GDI_Jackhammer_Final_06.jpg
 Description:
Direct fire mode
 Filesize:  251.59 KB
 Viewed:  3030 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  Mark this post and the followings unread

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
Plasma Trooper


Joined: 05 Apr 2009

PostPosted: Wed May 20, 2015 9:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

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] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


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


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
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

[ Time: 0.1496s ][ Queries: 15 (0.0113s) ][ Debug on ]