1、9. Add the attribute static = 1 in the Item object; Let the weapons in the game scene not move and increase the rotate = attribute to rotate the weapon in the game sceneRun the test to see if the above attributes are in effect10. Add collision detection member function onCollision (% this, % obj, %
2、col) for the weapon object data set object, and call the players weapon function in the function to let the weapon appear in the playerThe onCollision function parameter indicates that % this is the object of the weapon item % obj as the object of the weapon item % col is the object that objects to
3、the object is the playerThe test player will be able to pick up the weapon3. The status change of the weapon is realized by adding members of the weapon data set object11. The eyeOffset attribute is added to the weapon data set object, so that the position of the weapon in the first person state wil
4、l not be movedEyeOffset = 0.1 0.4-0.6;Run the test to see if the weapons position relative to the eye changes in the first person12. The definition attribute of the weapon state is added to the weapon data set object so that the weapon can be switched between several states/ / preactivation statusSt
5、ateName 0 = PreactivateStateTransitionOnLoaded 0 = Activate./ / the state of the transition condition / / transformationStateTransitionOnNoAmmo 0 = NoAmmo/ / activationStateName 1 = StateTransitionOnTimeout 1 = ReadyStateTimeoutValue 1 = 0.6;StateSequence 1 = / / standbyStateName 2 = StateTransition
6、OnNoAmmo 2 = StateTransitionOnTriggerDown 2 = Fire/ / fireStateName 3 = StateTransitionOnTimeout 3 = ReloadStateTimeoutValue 3 = 0.1;StateFire 3 = true;StateRecoil 3 = LightRecoil;StateAllowImageChange 3 = false;StateSequence 3 = StateScript 3 = onFire/ / ammunitionStateName 4 = StateTransitionOnNoA
7、mmo 4 = StateTransitionOnTimeout 4 = StateTimeoutValue 4 = 0.5;StateAllowImageChange 4 = false;StateSequence 4 = StateEjectShell 4 = true;/ / no ammunitionStateName 5 = StateTransitionOnAmmo 5 = StateSequence 5 = StateTransitionOnTriggerDown 5 = DryFire/ / dry fireStateName 6 = StateTimeoutValue 6 =
8、 1.0;StateTransitionOnTimeout 6 = Run the test to see if the weapon has a status change effect13. Join the member function of the weapon data set object (% this, % obj, % slot), call the function setImageAmmo, which sets the weapon cartridge in the function, and equip it with ammunition while pickin
9、g up the weaponThe onMount function parameter indicates that % this is the weapon data set object % obj as the object of the weapons object % slot for the weapons bullet objectWhether the weapon is set to use the ammunition function: player object. SetImageAmmo (bullets object, whether there are bul
10、lets (true or false);Run the test to see if the weapon has ammunitionIv. Bullets that add weapons to achieve weapons firing function14. The bullet ProjectileData set object that defines the weapon is CrossbowProjectile, and the projectileShapeName property of this object is associated with the bulle
11、t model file15. Add shot for weapons dataset onFire (% this, obj, % % slot) member functions, create a bullet object Projectile in function, for the bullet object add datablock properties for CrossbowProjectile, add initialVelocity attribute value for the 0 0 1, add initialPosition attribute value i
12、s % obj. The getMuzzlePoint slot (%), add sourceObject value is % objThe ononFire function parameter indicates that % this is the weapon data set object % obj is the object that is equipped with weapon and the player % slot is the bullet object for that weaponProperty description:The initial directi
13、on and vector of the initialVelocity / / bulletInitialPosition / / initial position of the bulletSourceObject / / an object that fires a bullet (action: the bullet will not collide with its object)Run the test to see if the weapon is fired after firing16. From Torque installer SDK/example/starter. T
14、he FPS/client/UI directory is copied to the crossHair. PNG sight picture to her game project/client/UI directory, and open the directory playGui. GUI file found in the file to create GuiCrossHairHud type game object code is copied to the project/client/UI/playGui GUI fileRun the test to see if there
15、 is a sight in the game17. Use the following member functions to complete the calculation of the direction of the bullet:Member function description:Player object. GetMuzzlePoint (% slot) / / get the location of the muzzlePlayer objects.GetMuzzleVector (% slot) / / the direction of the muzzlePlayer
16、object. GetVelocity (); / / a vector that moves the direction and speed of the playerVector calculation function:V3 is equal to VectorAdd (v1, v2) / / you can add vectors v1 and v2 to get the v3 vectorV3 is equal to VectorScale (v1, 10) / / Im going to zoom in 10 times the vector v1 to get the v3 ve
17、ctorFormula 1: the initial direction of the bullet = the vector of the direction of the gunRun the test to see if the direction of the bullet in the game is aligned with the direction of the gunFormula 2: the initial direction of the bullet = 300 times the vector of the direction of the gunRun the t
18、est to see if the bullet is getting faster in the gameFormula 3: the initial direction of the bullet is equal to 300 times the vector of the direction of the gun, plus the vector of the movement of the characterRun the test to see if the direction of the bullet in the movement is in line with the si
19、ght18. Adjust the properties of ProjectileData for the bullet data set and achieve the effect of the grenade still outLifetime = 5000; / / determine how long it will take to be deleted from the game worldFadeDelay = 5000; / / how long after the generation has become transparent (ie hidden)BounceElas
20、ticity = 0; / / bounce height after collisionBounceFriction = 0; / / the lost momentum of the bounceIsBallistic = true; / / confirm that the gravitational pull of gravity is not valid for the gravity of the earth.GravityMod = 0.001; / / gravity6. Use the attached particles to realize the particle ef
21、fect of weapon bullets19. The data set (particle ledata) object that creates the particle before defining the weapon script is CrossbowBoltParticle20. The textureName attribute is specified in the CrossbowBoltParticle data set as the path of smoke. PNG21. Create the particle emitter data set (Partic
22、leEmitterData) object CrossbowBoltEmitter22. Specify the particle attribute as CrossbowBoltParticle in the CrossbowBoltEmitter dataset23. Specify the particleEmitter attribute in the bullet data set object CrossbowProjectile as CrossbowBoltEmitterRun the test to see the bullet effect24. Add the foll
23、owing attributes to the CrossbowBoltParticle object to see the effectDragCoefficient = 0.0;GravityCoefficient = 0.35; / / gravity is negative to make it upward.InheritedVelFactor = 0.00; / / inertia obtained from other objects.LifetimeMS = 580; / / the display time of the particle is long.LifetimeVa
24、rianceMS = 150;UseInvAlpha = false;SpinRandomMin = 15.0;SpinRandomMax = 15.0;Colors 0 = 0.8 0.6 0.0 0.1 / / set the color of a sequence particleColors 1 = 0.8 0.65 0.0 0.1Colors 2 = 0.0 0.0 0.0 0.0Sizes 0 = 1.0; / / set the zoom size of a sequence particle.Sizes 1 = 2.0;Sizes 2 = 4.0;Times 0 = 0.1;
25、/ / set the time period of the particle sequence.Times 1 = 0.4;Times 2 = 1.0;25. Add the following properties to the CrossbowBoltEmitter object to see the effectEjectionPeriodMS = 15; / / how many milliseconds to emit a particle.PeriodVarianceMS = 5;EjectionVelocity = 0.35; / / the velocity of the p
26、article moving.VelocityVariance = 0.20;ThetaMin = 0.0; Minimum emission Angle of / / particle emitter (x axis)ThetaMax = 60.0; Maximum emission Angle of / / particle emitter (x axis)Run the test to see the modified bullet particle effect7: realize the effect of bullet explosion particle26.Repeat the 19-22 steps in part 6 to create:CrossbowExplosionParticle particle data sets (ParticleData
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2