personallight.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. class PersonalLight extends PointLightBase
  2. {
  3. void PersonalLight()
  4. {
  5. SetVisibleDuringDaylight(false);
  6. SetRadiusTo( 3 );
  7. SetBrightnessTo(0.38);
  8. SetDiffuseColor(0.2, 0.23, 0.25);
  9. SetCastShadow(false);
  10. EnableSpecular(false);
  11. EnableLinear(true);
  12. SetFlareVisible(false);
  13. }
  14. override void OnFrameLightSource(IEntity other, float timeSlice)
  15. {
  16. if ( GetGame() && IsEnabled() )
  17. {
  18. vector pos = GetGame().GetCurrentCameraPosition();
  19. pos += Vector( 0, -0.4, 0 );
  20. SetPosition( pos );
  21. }
  22. }
  23. // Experiment with dynamic range of Personal Light based on distance between camera and player's character.
  24. /*override void OnFrameLightSource(IEntity other, float timeSlice)
  25. {
  26. if ( GetGame() && IsEnabled() )
  27. {
  28. vector pos = GetGame().GetCurrentCameraPosition();
  29. vector dir = GetGame().GetCurrentCameraDirection();
  30. SetPosition(pos);
  31. DayZPlayer plr = GetGame().GetPlayer();
  32. if (plr)
  33. {
  34. vector pos_plr = plr.GetPosition() + Vector(0, 1.64, 0);
  35. float distance = vector.Distance( pos_plr, pos );
  36. //Print(distance);
  37. float radius = 20.0 + distance;
  38. SetRadiusTo( radius );
  39. }
  40. }
  41. }*/
  42. }