This article's documentation is for anything that uses the Source engine. Click here for more information.

cast_ray / cast_hull

From Valve Developer Community
Jump to navigation Jump to search
English (en)Translate (Translate)
edit
Example in Portal. (see file summary)

cast_ray and cast_hull are console commands available in all Source Source games. Casts a ray or hull and shows what it hit in console. Ray is visualized as green line up to the surface it hit where the normal is shown as yellow line. Hull is visualized in blue and also shows the normal as yellow line. Overlays last 10 seconds before disappearing.

Warning.pngWarning:Make sure your game is not paused when issuing these commands or the overlay for it won't show up. (type unpause in console before writing the command or bind it to a button bind e cast_ray)

Information it gives

DevMsg(1, "Hit %s\nposition %.2f, %.2f, %.2f\nangles %.2f, %.2f, %.2f\n", tr.m_pEnt->GetClassname(),
			tr.m_pEnt->GetAbsOrigin().x, tr.m_pEnt->GetAbsOrigin().y, tr.m_pEnt->GetAbsOrigin().z,
			tr.m_pEnt->GetAbsAngles().x, tr.m_pEnt->GetAbsAngles().y, tr.m_pEnt->GetAbsAngles().z );
		DevMsg(1, "Hit: hitbox %d, hitgroup %d, physics bone %d, solid %d, surface %s, surfaceprop %s, contents %08x\n", tr.hitbox, tr.hitgroup, tr.physicsbone, tr.m_pEnt->GetSolid(), tr.surface.name, physprops->GetPropName( tr.surface.surfaceProps ), tr.contents );

Examples

] cast_ray 
Hit func_breakable
position -456.00, -346.00, -132.00
angles 0.00, 0.00, 0.00
Hit: hitbox 0, hitgroup 0, physics bone 0, solid 1, surface maps/c1a0/halflife/glass_med_-521_-303_-144, surfaceprop glass, contents 00000001
] cast_hull 
Hit monster_gman
position -360.00, -316.00, -215.00
angles 0.00, 93.00, 0.00
Hit: hitbox 0, hitgroup 0, physics bone 0, solid 2, surface **studio**, surfaceprop default

See also

External links