Bullets
Last updated
Last updated
Universal Monster has a custom Line Trace that is affected by Gravity, Wind and Drag, which makes it perfect for Bullets. The Line Trace is done instantly, so it does not take into account travel time, but it does account for the distance a Bullet would travel over a certain amount of time.
Similar to creating a Melee or Projectile attack, you must create a Montage for the Bullet attack. Refer to the Melee section by clicking the link below if you do not know how to create a new Montage.
MeleeThe Bullet attack does not need any more information configured in the Attacks Array because it will pull its attack information from the Get Bullet Info interface function in BPI_UniversalMonster.
BPI_UniversalMonsterBullets must have Bullet Info in order to run their trace and do damage. You will need to add a new variable to your character using the struct S_BulletInfo. You can then configure this variable with default settings and then pass it along in the Get Bullet Info interface function. If you have multiple weapons that need to have different Bullet Info settings, then you can make this variable a map or array so that you can choose the different settings when needed. The ESRPG example uses a map of Static Mesh to S_BulletInfo which sends different settings depending on the currently equipped Static Mesh.
Data Table Row: You can store your Bullet Info in a data table. Location: The location to start the Bullet trace. Direction: The initial direction of the Bullet trace. Speed: The initial velocity of the Bullet trace. Accuracy: Value from 0 to 100 to determine the accuracy of the Bullet trace, which will add a rotation offset to the Direction. Accuracy Multiplier: Angle, in degrees, to offset the Direction when Accuracy is 0. Time: Number of seconds used to simulate the Bullet trace. The trace is still done instantly. Traces: Number of traces to calculate. The higher the value, the more accurate the Bullet trace, but it will cost more in performance. Drag: Amount of velocity subtracted from the current velocity every second of the Bullet trace. Gravity: Accelerates the Bullet by the chosen vector. Default gravity is (0, 0, -980). Wind: Offsets the Bullet by the chosen vector. This vector is randomized during the Bullet trace to provide a more realistic simulation. Trace: The trace settings to use for the Bullet. Enable Debugging?: Should the traces be shown for debugging? Debug Draw Type: Show the trace for a single frame or a duration. Debug Trace Color: Color of the trace before a hit occurs. Debug Hit Color: Color of the trace after a hit occurs. Debug Draw Time: The duration to show the trace.