Log in to reply
 

3D Floating info box.



  • For my debugging tools, I would like to add a floating info box display over certain items. Does anyone have any tips on what I need to use to do this?

    A bit like this:

    alt text



  • Ok, so I have this working with basic text now, based on some code found on GTAForums. If anyone has any info on how to embellish the display in any way, that would still be helpful.

    I know I should probably be looking for all this info myself but with three mods on the go, time's in short supply, so all help is very much appreciated. :slight_smile:



  • @LeeC2202 in this case, you might want to have a look at this https://www.gta5-mods.com/tools/developer-helper



  • @FoxtrotDelta That was the mod I used to use. :D

    I'd like to have a bit more control over it, so I am trying to learn how it all works. I have it working with basic text, so that's a start, the rest is just fluff to make it look nicer... the text is the important part though.



  • @LeeC2202 ah okay.



  • @FoxtrotDelta That was also the mod that inspired me to do the bounding box thing as well.

    If you remember what I was saying about other people's code and how I use it to inspire me to learn, well this is a classic case of someone else's mod inspiring me the same way.

    Never underestimate the power of great inspiration. :D I am always several steps behind the genuine programmers out there, so I have to watch, get motivated and learn, any way I can.



  • @LeeC2202 inspirations and aspirations, are two great things.



  • So it turns out the way I thought I had solved this, with a Scaleform instance doesn't work, because I can only get one to appear for all classes, instead of one per class. :(



  • You can do something like this. It does still have some limitations on how many can be displayed. Not sure why maybe text limit?

         Vehicle[] vecs = World.GetNearbyVehicles(Game.Player.Character.Position, 50.0f);
    
        if (vecs.Count() > 0)
        {
            foreach (Vehicle v in vecs)
            {
                float distance = World.GetDistance(World.RenderingCamera.Position, v.Position);
    
                if (v.Model.IsCar && v.Position.DistanceTo(Game.Player.Character.Position) < 50.0f)
                {
                    Vector3 drawPosition = v.Position + v.UpVector * 1.5f;
                    Function.Call(Hash.SET_DRAW_ORIGIN, drawPosition.X, drawPosition.Y, drawPosition.Z, 0);
                    Function.Call(Hash._SET_TEXT_ENTRY, "STRING");
                    Function.Call(Hash._0x39BBF623FC803EAC, 1);
                    Function.Call(Hash.SET_TEXT_SCALE, 0.0f, .25f + distance / 10000.0f);
                    Function.Call((Hash)0x6C188BE134E074AA, "CAR");//ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME
                    Function.Call(Hash._DRAW_TEXT, 0.0F, 0.0F, 0);
                    Function.Call(Hash.CLEAR_DRAW_ORIGIN);
                }
            }
        }


  • @aimless I'll give that a try, thank you. There has to be a way to get lots of them on screen, because the developerhelper mod displayed a lot of information in a similar way.

    Maybe I am relying on SHVDN too much, I keep thinking I should just write my own wrapper for the natives instead. I am sure that the natives allow you to set Scaleform instances and manage them on an ID basis.

    I've just had another instance where SHVDN had put a set property onto a native that only has a get property, so that caused an insta-crash. SHVDN can be quite infuriating at times.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.