Advertisement
Guest User

Untitled

a guest
Dec 27th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. void Unit::UpdateModelData()
  2. {
  3. float boundingRadius, combatReach;
  4.  
  5. if (CreatureModelInfo const* modelInfo = sObjectMgr.GetCreatureModelInfo(GetDisplayId()))
  6. {
  7. if (GetTypeId() == TYPEID_PLAYER)
  8. {
  9. // Bounding radius and combat reach is normally modified by scale, but player is always 1.0 scale by default so no need to modify values here.
  10. boundingRadius = modelInfo->bounding_radius;
  11. combatReach = modelInfo->combat_reach;
  12. }
  13. else
  14. {
  15. // We expect values in database to be relative to scale = 1.0
  16. float scaled_radius = GetObjectScale() * modelInfo->bounding_radius;
  17.  
  18. boundingRadius = modelInfo->combat_reach;
  19. combatReach = GetObjectScale() * (modelInfo->bounding_radius < 2.0 ? modelInfo->combat_reach : modelInfo->combat_reach / modelInfo->bounding_radius);
  20. }
  21. }
  22.  
  23. SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, boundingRadius);
  24. SetFloatValue(UNIT_FIELD_COMBATREACH, combatReach);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement