Object Text Position
#1

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?
Reply
#2

BUMP!
Reply
#3

BUMP
Reply
#4

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
Reply
#5

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:
Reply
#6

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)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)