SA-MP Forums Archive
Object Text Position - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Object Text Position (/showthread.php?tid=601852)



Object Text Position - Dusan01 - 27.02.2016

Hi guys, i have this code:

Code:
new Float:novix = fX;
new Float:noviy = fY;
noviy -= 3.0;
objekt = CreateObject(19327, novix, noviy, fZ -= 0.8, fRotX, fRotY, fRotZ);
SetObjectMaterialText(objekt, "{0080FF}Trafika", 0,  130, "Comic Sans MS", 140, 0, -9591092, 0, 1);
and what is problem? The problem is that cordinates are cordinates of 1 object, and i want to make this text allways be in front of that object, but i have some problems, when i put object without rotation edit text is good, but when i rotate him for 180 degrees i get this:


text is again on same side, how can i fix that?


Re: Object Text Position - Dusan01 - 28.02.2016

BUMP!


Re: Object Text Position - Dusan01 - 01.03.2016

BUMP


Re: Object Text Position - [NWA]Hannes - 01.03.2016

What you're doing is that you're attaching the text to statically be -3.0 from the object's Y at all times, which isn't efficient. If you rotate the object, the text will still be -3.0 from the object's Y coordinate, making rotations inefficient.

Try simply attaching the text object to the main object, using AttachObjectToObject. The text object will then follow the main object no matter how much you rotate it.

https://sampwiki.blast.hk/wiki/AttachObjectToObject


Re: Object Text Position - Dusan01 - 03.03.2016

Tnx for that, but i have moving vehicle now, and i allways want to object be created at the same position of vehicle, and then to move that object to ground, here is where i want to create object, so how should i do that:


Re: Object Text Position - Nero_3D - 03.03.2016

For a relative position you could use the VehicleMatrix include
Than you need to figure out the right offsets by trial and error
Moving the object to the ground shouldn't be the problem with MoveObject with Z - 4.0 (or something like that)