Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. Добавить в Utility:
  2. rotationToDirection(rotation: Vector3) {
  3. const z = this.degreeToRadian(rotation.z);
  4. const x = this.degreeToRadian(rotation.x);
  5. const modifier = Math.abs(Math.cos(x));
  6.  
  7. return new alt.Vector3(-Math.sin(z) * modifier, Math.cos(z) * modifier, Math.sin(x));
  8. }
  9.  
  10. degreeToRadian(degree: number) {
  11. return (degree * Math.PI) / 180.0;
  12. }
  13.  
  14. Добавить в Raycast.line:
  15. вместо:
  16. let playerForwardVector = game.getEntityForwardVector(this.player.scriptID);
  17. playerForwardVector.x *= scale;
  18. playerForwardVector.y *= scale;
  19. playerForwardVector.z *= scale;
  20.  
  21. let targetPos = this.getTargetPos(this.player.pos, playerForwardVector);
  22.  
  23. добавить:
  24. const rotation = game.getGameplayCamRot(1);
  25. const direction = Utility.rotationToDirection(rotation);
  26. direction.x *= scale;
  27. direction.y *= scale;
  28. direction.z *= scale;
  29.  
  30. const targetPos = this.getTargetPos(this.player.pos, direction);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement