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

Cast ray: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{LanguageBar|title = {{mono|cast_ray / cast_hull}}}}
{{LanguageBar|title = {{mono|cast_ray / cast_hull}}}}
{{TabsBar}}
{{TabsBar}}
[[File:Cast ray-example.jpg|thumb|right|Example in {{portal}}. (see [[:File:Cast ray-example.jpg|file summary]]) ]]
{{This is a|console command|name=cast_ray|name1=cast_hull|notitlechange=1}} Casts a ray or hull and shows what it hit in console.
{{This is a|console command|name=cast_ray|name1=cast_hull|notitlechange=1}} Casts a ray or hull and shows what it hit in console.



Revision as of 05:51, 12 May 2025

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.

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