🅱

From SRB2 Wiki
Jump to navigation Jump to search

The

mobj_t stuff

cSpdEx

The snippet
rawset(_G, "cSpdEx", function(hang, vang, spd, m)
	if hang == nil then error("hAng missing", 2) end
	if vang == nil then error("vAng missing", 2) end
	if spd == nil then error("spd missing", 2) end
	if m == nil then m = {scale=FRACUNIT} end
	spd = FixedMul(spd, m.scale)
	local x = FixedMul( FixedMul( spd, cos(hang) ), cos(vang) )
	local y = FixedMul( FixedMul( spd, sin(hang) ), cos(vang) )
	local z = FixedMul( spd, sin(vang) )
	return x,y,z
	//returns xyz of calc
end)

Format: cSpdEx(angle_t hang, angle_t vang, fixed_t spd, [mobj_t mobj])
Returns: fixed_t, fixed_t, fixed_t

This function returns three values forming a 3D vector aiming to horizontal angle hang and vertical angle vang with a force of spd.