Cast ray: Difference between revisions
Jump to navigation
Jump to search

Warning: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
(Created page with "{{LanguageBar|title = {{mono|cast_ray / cast_hull}}}} {{This is a|console command|name=cast_ray|name1=cast_hull}} Casts a ray or hull and shows what it hit in console. {{warning|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 {{cmd|bind}} it to a button <code>bind e cast_ray</code>)}} == See also == * {{cmd|box (console command)|alt=box}} * {{cmd|drawcross|alt=draw...") |
mNo edit summary |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{LanguageBar|title = {{mono|cast_ray / cast_hull}}}} | {{LanguageBar|title = {{mono|cast_ray / cast_hull}}}} | ||
{{This is a|console command|name=cast_ray|name1=cast_hull}} Casts a ray or hull and shows what it hit in console. | {{TabsBar}} | ||
[[File:Cast ray-example.jpg|thumb|right|Example in {{portal}}. (see [[:File:Cast ray-example.jpg#Summary|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. 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|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 {{cmd|bind}} it to a button <code>bind e cast_ray</code>)}} | {{warning|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 {{cmd|bind}} it to a button <code>bind e cast_ray</code>)}} | ||
__NOTOC__ | |||
=== Information it gives === | |||
<syntaxhighlight lang=cpp> | |||
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 ); | |||
</syntaxhighlight> | |||
== Examples == | |||
<pre> | |||
] 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 | |||
</pre> | |||
<pre> | |||
] 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 | |||
</pre> | |||
== See also == | == See also == | ||
* {{cmd|box (console command)|alt=box}} | * {{cmd|box (console command)|alt=box}} | ||
* {{cmd|drawcross|alt=drawcross / drawline}} | * {{cmd|drawcross|alt=drawcross / drawline}} | ||
== External links == | |||
* [https://github.com/ValveSoftware/source-sdk-2013/blob/61ca3f725417d5b479824cded09eaab1909151be/src/game/server/client.cpp#L442-L464 cast_hull definition] | |||
* [https://github.com/ValveSoftware/source-sdk-2013/blob/61ca3f725417d5b479824cded09eaab1909151be/src/game/server/client.cpp#L420-L440 cast_ray definition] |
Latest revision as of 06:10, 12 May 2025


cast_ray
and cast_hull
are console commands available in all 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.

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