Jump to content

Recommended Posts

Is there a way so that 3d Icons (custom) such as ones over as units head scale in size according to distance? As it is they look huge and block a unit when far away and then seem to scale down or look proper when you approach

Share this post


Link to post
Share on other sites
1 hour ago, froggyluv said:

Is there a way so that 3d Icons (custom) such as ones over as units head scale in size according to distance? As it is they look huge and block a unit when far away and then seem to scale down or look proper when you approach

Have a look at the code in TPW HUD mate, this does what you describe. It is non trivial though.

Share this post


Link to post
Share on other sites

Eastiest way is to use a linearConversion on the icon width and height based off of distance.

All depends on a few things like..

is there a max distance you should see an icon.

Is there a min size an icon should be

etc.

_minSize = 0.25;
_furthestDistance = 20;
_iconSize = linearConversion[ 0, _furthestDistance, player distance2D _target, 1, _minSize, true ];

Then just plug the _iconSize into the drawIcon3D's width and height parameters.

Here when the player is 0 meters away from the target the icon is size 1.

As the player moves away from the target the icon goes down to a minimum of 0.25 at 20 meters.

True just makes it so no matter how far the distance is it will always be a min icon scale of 0.25.

Just find some values you like.

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

 

 Larrow that works amazingly well - learn something new everyday down here

  • Like 1

Share this post


Link to post
Share on other sites

Can i do it that its going to be bigger when im nearer @Larrow

 

if -> player farer away -> be smaller

if -> player closer -> be bigger

Share this post


Link to post
Share on other sites

@Armanda551

Quote

No spam or advertising:

Advertising of any commercial or personal project, product or service on these forums is not permitted. Chain letters and pyramid schemes are similarly prohibited. This includes the Personal Message service and clan recruitment outside of the Clan Recruitment forum. Threads older than 4 months should not be dug up unless something significant is being added. Please do not post duplicate threads in more than one forum and do not "Bump" threads. Posting "any news", "is it out yet" or asking for a release date type posts are also spam.

You are violating the guidelines real quick. Please do it further in your own thread. AND YOU ALREADY FOUND YOUR ANSWER. STOP SPAMMING.

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×