Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DSH_TraceBeam : actor
- {
- color col;
- vector3 endPoint;
- vector3 actorOffset;
- int lifeTime;
- bool TrackHitPoint;
- Default
- {
- radius 0;
- height 0;
- +NOBLOCKMAP;
- +NOGRAVITY;
- +NOINTERACTION;
- +NOTELEPORT;
- +CANNOTPUSH;
- +NODAMAGETHRUST;
- RenderStyle "AddShaded";
- StencilColor "AAFFFF";
- }
- override void PostBeginPlay()
- {
- A_SetPitch(pitch+90);
- SetShade(col);
- Super.PostBeginPlay();
- }
- override void Tick(void)
- {
- Super.Tick();
- if(target)
- {
- if(!TrackHitPoint)
- {
- A_SetAngle(Target.Angle+DeltaAngle(target.angle,self.angle), SPF_INTERPOLATE);
- A_SetPitch(Target.Pitch+DeltaAngle(target.pitch,self.pitch-90.0)+90.0, SPF_INTERPOLATE);
- //A_SetAngle(Target.Angle, SPF_INTERPOLATE);
- //A_SetPitch(Target.Pitch-90.0, SPF_INTERPOLATE);
- /* this is some insane magic shit*/
- double oldAngle = Target.Angle; // Doing this because it's way more precise to do this than to decrement
- Target.A_SetAngle (Target.angle + 0.001, SPF_INTERPOLATE);
- Target.A_SetAngle (oldAngle, SPF_INTERPOLATE);
- /* insanity ends*/
- }
- //moves the actor
- SetOrigin(target.Vec3Offset(actorOffset.x, actorOffset.y,(Target.player.ViewZ - Target.Pos.Z)+actorOffset.z, FALSE),TRUE);
- if(TrackHitPoint)
- {
- vector3 dif = self.pos - endpoint;
- vector2 angs = DSH_kMath.AnglesFromVec3(dif);
- A_SetAngle(angs.x, SPF_INTERPOLATE);
- A_SetPitch(angs.y+90, SPF_INTERPOLATE);
- scale.y = (self.pos-endpoint).length();
- }
- }
- }
- States
- {
- Spawn:
- MODL A 0 nodelay;
- MODL A 1 bright nodelay A_SetTics(lifeTime);
- stop;
- }
- }
- action actor VectorBeam (vector3 startpos, vector3 endpos, double rad)
- {
- actor act = actor.spawn("DSH_TraceBeam",startpos,NO_REPLACE);
- let a = DSH_TraceBeam(act);
- if(a)
- {
- vector3 dif = startpos - endpos;
- vector2 angs = DSH_kMath.AnglesFromVec3(dif);
- a.angle = angs.x;
- a.pitch = angs.y;
- a.scale.y = (startpos-endpos).length();
- a.scale.x = rad;
- }
- return act;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement