Bullet Holes
Jump to navigation
Jump to search
Bullet Holes | |
---|---|
Topic | Coding |
Series | Chimeric |
In this tutorial we're going to see how to create Bullet Holes.
Overview
This code is fairly generalized, and you can use it for bullet holes, scorch marks, blood splatters etc..etc.. It is a modified ProcessTraceHit(), so its called by TraceHit(). It doesn't have to be used by trace hit, you could copy it into a projectile's HitWall() for a rocket/grenade/etc, but it's suggested that if you're using a projectile to still call TraceHit() and leave the code here as is, for better reliability.
Code
function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z) { '''// This is a container for the Bullet Hole effect''' local actor BH; '''// This var will be used later to determine the floor''' local Float FloorNormal; '''// This dot product returns a float number -1.0 is the''' '''// ceiling, 1.0 is the floor, 0.0 is a wall..this of''' '''// course assumes the surfaces are flat''' FloorNormal = HitNormal Dot vect(0,0,1); '''// you don't want it to appear on people, or their dead bodies =)''' if ((!Other.Isa('Pawn')) && (!Other.IsA('Carcass'))) { '''// And it looks like crap on the floor if the texture is like''' '''// grass or somthing so don't draw it''' if (FloorNormal < 1.00) { '''// Do the Deed =P''' '''// HitEffect is declared elsewhere as:''' '''// var() Class HitEffect;''' BH = Spawn(HitEffect,,,HitLocation); '''// Make it stick to the obj''' BH.SetBase(Other); '''// the gfx used was to big, so i shrank it''' BH.DrawScale /= 10; } } }
External links
<references />
See also
Chimeric tutorials |
---|