Advertisement
ijontichy

<stdin>

Mar 6th, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. script 454 (int scaleI, int scaleF, int speedF)
  2. {
  3. int scale, x, y, z, mag;
  4. x = GetActorVelX(0); y = GetActorVelY(0); z = GetActorVelZ(0);
  5.  
  6. if (speedF == 0) { scale = itof(scaleI) + (scaleF * 0.01); }
  7. else
  8. {
  9. mag = magnitudeThree_f(x, y, z);
  10.  
  11. if (mag == 0)
  12. {
  13. x = random(-10.0, 10.0);
  14. y = random(-10.0, 10.0);
  15. z = random(-10.0, 10.0);
  16. mag = magnitudeThree_f(x, y, z);
  17. }
  18.  
  19. scale = FixedDiv(speedF * 1.0, mag);
  20. }
  21.  
  22. SetActorVelocity(0, FixedMul(x, scale), FixedMul(y, scale), FixedMul(z, scale), 0, 0);
  23. // PrintBold(s:"(", f:x, s:", ", f:y, s:", ", f:z, s:"): ", f:scale, s:" -> (", f:GetActorVelX(0), s:", ", f:GetActorVelY(0), s:", ", f:GetActorVelZ(0), s:")");
  24. // printf("(%f, %f, %f): %f -> (%f, %f, %f)\n", x, y, z, scale, GetActorVelX(0), GetActorVelY(0), GetActorVelZ(0));
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement