Skip to content

drc_RotateMag Material Proxy

Vuthakral edited this page Nov 29, 2022 · 1 revision

The "Rotate Mag" material proxy was added for the use of making a material rotate with the current percentage of a weapon's magazine. I.e. a weapon with 4/8 rounds left in its magazine will have this material rotated by half of the defined degrees in its settings.

Example VMT:

VertexLitGeneric
{
	$basetexture	"models\vuthakral\halo\weapons\M7057\needle"
	$alphatest	1

	$detail	"models\vuthakral\halo\weapons\M7057\needle_i"
	$detailscale	1
	$detailblendmode	5
	$detailblendfactor	1

	$phong	1 
	$phongexponent	19
	$phongboost	7
	$phongfresnelranges	"[ 0.07 0.3 1 ]" 

	$radius		-180
	$radius_ls		1
	$angle		0
	$translate		"[ 0 0 ]"
	$center		"[ .5 .5 ]"
	$scale		"[ 1 1 ]"

	Proxies
	{
		drc_RotateMag
		{
			resultVar $angle
		}
		TextureTransform
		{
			"translateVar" 	$translate
                		"rotateVar"	$angle
                		"centerVar"	$center
			"scaleVar"	$scale
                		"resultVar"	$basetexturetransform
		}
		TextureTransform
		{
			"translateVar" 	$translate
                		"rotateVar"	$angle
                		"centerVar"	$center
			"scaleVar"	$scale
                		"resultVar"	$detailtexturetransform
		}
	}
}

This is the needle on the pressure gauge of a flamethrower weapon. It has an angle value of -180, and a linear interpolation speed of 1. These settings will make the needle rotate from pointing 90 degrees to the right all the way to 90 degrees to the left, depending on how much ammo is left in the weapon.

NOTE: By nature of how texture transform works in Source, you need the other material proxies as well for this one to work.

Clone this wiki locally