DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ RaycastRV()

static proto bool DayZPhysics::RaycastRV ( vector begPos,
vector endPos,
out vector contactPos,
out vector contactDir,
out int contactComponent,
set< Object > results = NULL,
Object with = NULL,
Object ignore = NULL,
bool sorted = false,
bool ground_only = false,
int iType = ObjIntersectView,
float radius = 0.0,
CollisionFlags flags = CollisionFlags.NEARESTCONTACT )
staticprivate

Raycasts world by given parameters.

Аргументы
begPosvector Begin position of raycast (e.g. player position)
endPosvector End position of raycast (e.g. player direction)
contactPosvector out, world position of first contact
contactDirvector out, direction of first contact (available only when object is hitted)
contactComponentint out, object component index (available only when object is hitted)
resultsset<Object> out, set of objects hitted by raycast. Can be NULL if not needed
withObject Ignores the object from collision. Used only when ground_only is false. Can be NULL if not needed
ignoreObject Ignores the object from collision. Used only when ground_only is false. Can be NULL if not needed
sortedbool Default value is false, used only if ground_only = false
ground_only\bool raycasts only ground (ignores all objects). Default value is false if not needed.
iTypeint, type of intersection, possible values ObjIntersectFire(0), ObjIntersectView(1), ObjIntersectGeom(2), ObjIntersectIFire(3), ObjIntersectNone(4)
radiusfloat Radius of the ray, default value set to 0
Возвращает
bool return true if raycast hits ground or object
// raycast test
PlayerBase player = g_Game.GetPlayer();
if (player)
{
vector begPos = player.GetPosition();
vector endPos = begPos + (player.GetDirection() * 100);
vector contactPos;
vector contactDir;
int contactComponent;
set<Object> results = new set<Object>;
Object with;
Object ignore;
bool sorted;
bool ground_only;
int iType;
float radius;
if ( GetGame().Raycast(begPos, endPos, contactPos, contactDir, contactComponent, results, with, ignore, sorted, ground_only, iType, radius) )
{
Print(begPos);
Print(endPos);
Print(contactPos);
Print(contactDir);
Print(contactComponent);
Print(results);
Print(with);
Print(ignore);
Print(sorted);
Print(ground_only);
Print(iType);
Print(radius);
Print( GetGame().Raycast(begPos, endPos, contactPos, contactDir, contactComponent, results, with, ignore, sorted, ground_only, iType, radius) );
}
}
>> vector begPos = 0x00000000dd62df30 {<750.573,49.8043,2167.25>}
>> vector endPos = 0x00000000dd62df3c {<849.589,49.8043,2181.25>}
>> vector contactPos = 0x00000000dd62df48 {<751.068,49.8043,2167.32>}
>> vector contactDir = 0x00000000dd62df54 {<0.987203,2.04891e-08,0.139505>}
>> int contactComponent = 8
>> set<Object> results = set<Object><a022d840>
>> Object with = NULL
>> Object ignore = NULL
>> bool sorted = 0
>> bool ground_only = 0
>> int iType = 0
>> float radius = 0
>> 1
DayZGame g_Game
Определения DayZGame.c:3868
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
Определения EnConvert.c:106
class LOD Object
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.

Используется в ItemBase::DoMeasurement(), PoweredOptic_Base::DoMeasurement(), WeaponDebug::DrawLineOfFire(), WeaponDebug::DrawLineOfFireCameraHybrid(), WeaponDebug::DrawLineOfFireMuzzleToHit(), Event_OnClick(), PluginBase::Event_OnClick(), PluginBase::Event_OnClickMiddle(), PluginBase::Event_OnDoubleClick(), PluginBase::Event_OnDrag(), FloatingCrossHair(), ManBase::GetAimPosition(), UIScriptedMenu::GetCameraLookDir(), GetCeilingHeight(), UIScriptedMenu::GetMouseLookDir(), PluginBase::GetMousePositionInScene(), GetProjectedCursorPos3d(), Hologram::GetProjectionEntityPosition(), AreaDamageBase::GetRaycastedHitZone(), HitZoneSelection(), HitZoneSelectionRaycast(), Hologram::IsBaseViable(), Hologram::IsInTerrain(), IsObjectObstructedFilterEx(), IsUnderRoofEx(), ScriptConsoleItemsTab::OnClick(), UIScriptedMenu::OnClick(), ScriptConsoleItemsTab::OnDoubleClick(), Hologram::SetOnGround() и DeveloperTeleport::TeleportAtCursor().