Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
Tutorial: Custom non-curving tracer models, nice projectiles without SAGE going berserk
post 10 Apr 2017, 8:16
Post #1

Group Icon

Group: Dev. Team
Posts: 276
Joined: 10 June 2009
From: Austria
Member No.: 123

Hi everyone

I discovered a new method how to do proper projectile models in ZH without having to deal with curving projectiles over cliffs.

Here's how to do it.

1.) In System.ini, look at first object entry 'GenericTracer'. This is the default tracer object that's used with any 'Tracer' entry in a Fire FX. We can use 'TracerName' field in a FireFX to use a different object:

FXList WeaponFX_HeavyGunnerMGFireNoTracer
    Color = R:255 G:255 B:128
    Radius = 10
    IncreaseTime = 0
    DecreaseTime = 200
    Name = GattlingCannonLenzflare
    OrientToObject = Yes
    Offset = X:0.0 Y:0.0 Z:0.0
    Name = FallingShellsRight
    OrientToObject = Yes
    Offset = X:-6.0 Y:0.0 Z:0.0
    TracerName = BulletTracerSmall;<---------
    Speed = 600
  ;Probability = 0.5

You can't use 'Length', 'Width' or 'Color' attributes here, since these only work with the default tracer draw module. 'Probability' works just fine.
'DecayAt' and 'Speed' basically determine the lifetime of your tracer. DecayAt should be 1 and Speed should be synced with the respective WeaponSpeed value (and the animation of your model. We'll come to that later).

Back in System.ini, duplicate 'GenericTracer' to create a custom object.

Object BulletTracerSmall;Scaled to WeaponSpeed = 600
  EditorSorting = SYSTEM
  Draw = W3DModelDraw ModuleTag_01
    ConditionState = None
      Model = EXBTSmall    
      Animation = EXBTSmall.EXBTSmall
      AnimationSpeedFactorRange = 1.6 2.4;1.0 = 300, 2.0 = 600

The 'GenericTracer' has a TracerDraw module which draws a colored box and animates it. We can use a fancy model here, but we have to animate it manually. The idea is to use a regular draw module, where the movement of the projectile is specified in the animation. Now the important part is to sync the animation speed with the WeaponSpeed and Tracer Speed to make the BulletTracer object disappear when the weapon hits. (Note: I use 'AnimationSpeedFactorRange = 1.6 2.4' to get some variation and make it look better with fast firing weapons)

The model I use has an animation which moves the bullet from X:0 to X:600 over 60 frames (Remember to use linear animation, so it doesn't accellerate). Since generals uses 30fps, this is a speed of 300. If your unit has higher range you need to make the animation go even further, but I guess 600 is enough for most cases. In my draw module I used 'AnimationSpeedFactorRange' to scale the speed to 600.

Before the model is finished we need to add a boundingbox, so the model is visible even when its origin is out of view. To do this, you add a box over the movement direction of the model and set it's export options to 'AABox'. It's up to you how large you want this box to be. Again, it depends on the weapon range. I don't think it will affect performance too much so just go for full range (e.g. 600) if you want.

If you set up the model correctly and added a proper FireFX to your weapon it should now show your custom tracer model and it should properly sync with the weapon speed. For different weapon speeds you would need to duplicate the object and adjust the AnimationSpeed.

This method prevents all the ugly curving at Cliffs and your projectiles will no longer go through a target. You could also add a bone in your model and attach particles (using 'ParticlesAttachedToAnimatedBones = Yes') to the model to add Particle Trails. You could also use this methods in combination with lasers to create a pulse effect.

Some limitations: Scatter radius won't work. The tracers are always on point. You could however add varying animations with some scattering, and use IdleAnimations to randomize them. Example model and max files attached.

Some screenshots (Can't really show much on images, though)


Reuploaded all images to imgur.

This post has been edited by Stalker: 16 Sep 2017, 12:19
Attached File(s)
Attached File  BulletTracer.zip ( 20.17K ) Number of downloads: 15
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


Lo-Fi Version Time is now: 24 January 2020 - 23:55