DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Raycaster.c
См. документацию.
1// Item for raycast debugging. It's also fun to play around with at night.
2
3class Raycaster extends ItemBase
4{
5 protected ref Timer m_Timer;
6
7 override void OnWorkStart()
8 {
9 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) // Client side
10 {
12 }
13 }
14
16 {
17 if( !m_Timer )
18 {
19 m_Timer = new Timer;
20 }
21
22 m_Timer.Run( 0.01, this, "PrepareMeasurement", null, true );
23 }
24
26 {
29 }
30
32 {
33 float dispersion = 80;
34
35 vector from = GetPosition() + ( GetMemoryPointPos("beamStart") + ((GetOrientation()+Vector(90,0,0)).AnglesToVector()*0.3) );
36 vector ori = GetOrientation() + Vector(90,0,0) + Vector(dispersion/2 - Math.RandomFloat(0, dispersion) , dispersion/2 - Math.RandomFloat(0, dispersion) , dispersion/2 - Math.RandomFloat(0, dispersion) );
37 vector to = from + (ori.AnglesToVector() )* 30;
38 vector contact_pos;
39 vector contact_dir;
40 int contactComponent;
41
42 bool is_collision = DayZPhysics.RaycastRV( from, to, contact_pos, contact_dir, contactComponent, NULL , NULL, GetHierarchyRootPlayer(), false, false, ObjIntersectIFire);
43
44 if (is_collision)
45 {
46 vector hit_normal = contact_dir.VectorToAngles();
47 hit_normal[1] = hit_normal[1] + 90;
48
49 // Generate result
50 Particle p = ParticleManager.GetInstance().PlayInWorld(ParticleList.DEBUG_DOT, contact_pos);
51 p.SetOrientation(hit_normal);
52 }
53 }
54
56 {
57 if( m_Timer )
58 {
59 m_Timer.Stop();
60 }
61 }
62
63 override void OnWorkStop()
64 {
65 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) // Client side
66 {
68 }
69 }
70
71 override void SetActions()
72 {
73 super.SetActions();
74
77 }
78}
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
vector GetOrientation()
Определения AreaDamageManager.c:306
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
static proto bool 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)
Raycasts world by given parameters.
Определения DayZPhysics.c:124
override void OnWorkStart()
Определения Raycaster.c:7
void StartPeriodicMeasurement()
Определения Raycaster.c:15
override void SetActions()
Определения Raycaster.c:71
void PrepareMeasurement()
Определения Raycaster.c:25
void StopPeriodicMeasurement()
Определения Raycaster.c:55
override void OnWorkStop()
Определения Raycaster.c:63
void DoMeasurement()
Определения Raycaster.c:31
ref Timer m_Timer
Определения Raycaster.c:5
Определения InventoryItem.c:731
Определения EnMath.c:7
Legacy way of using particles in the game.
Определения Particle.c:7
static const int DEBUG_DOT
Определения ParticleList.c:23
Определения ParticleList.c:12
Определения DayZPlayerImplement.c:63
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
Определения EnConvert.c:106
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9