Jump to content

Hovertext centered on prim... *CENTERED* not above center


Domitan Redenblack
 Share

You are about to reply to a thread that has been inactive for 4336 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

There is no way to manipulate or script  hovertext to center it perfectly.  However, what you can do if you are  to make buttons on a hud where the sides of the button won't show is to make a texture with a small portion on the bottom transparent and the transparent area equal to the offset. either in the texture itself or by using texture offsets to acheive this  Your other choice would be to make the words change on a button is by scripting it to change textures when clicked or a choice is made.

 

Link to comment
Share on other sites

If you're just trying to center text on a flat surface, try this:

  • Size: <0.5, 0.5, 0.01>
  • Rotation: <0.0, 90.0, 0.0>
  • Slice (begin / end) : 0.98 / 1.0

Then play around with the Top Shear X slider to move up and down the prim's "stuff" relative to its origin.  Playing with Taper X, you can even get the text to appear below what remains of the prim.

Not really anything a script can do, other than set the prim parameters (except slice, grrrr!).

Link to comment
Share on other sites


Qie Niangao wrote:

If you're just trying to center text on a flat surface, try this:
  • Size: <0.5, 0.5, 0.01>
  • Rotation: <0.0, 90.0, 0.0>
  • Slice (begin / end) : 0.98 / 1.0

Then play around with the Top Shear X slider to move up and down the prim's "stuff" relative to its origin.  Playing with Taper X, you can even get the text to appear
below
what remains of the prim.

Not really anything a script can do, other than set the prim parameters (except slice, grrrr!).

When I tried top shear, the title did not move, but a second "surface" appeared to move up and down. How does this help?

Perhaps you could send me an object done right, in world?

 

Link to comment
Share on other sites

You have to use one of the rounded prims (sphere, tube, ring, or torus) that supports dimple or advanced cut. 

Unfortunately,  switching it back to a box, even using the legacy interface, resets the slice parameter, so you're stuck with having to take a very small slice a rounded prim to get a square.

None of this if of any use except for a HUD anyway, because the text will appear to move up and down depending on how close you are to the object if it is in-world.

 

Link to comment
Share on other sites

Hmmm; these responses are puzzling. Not sure what this "second 'surface'" would be, exactly.  Again, this is only relevant to positioning text on a flat surface; if you have other plans for that prim besides bearing text as a kind of two-sided billboard, then this isn't relevant.

Rufus is quite correct that the text moves up and down as the cam moves, for non-HUD prims.  That point is completely valid; still, however, one may want to adjust the apparent height of the text relative to the object's origin, even as affected by cam position, so there's some utility here even for some non-HUD applications.

I'm less clear about the "dimple" thing.  Back in the day, before viewers (universally?) had "slice" parameters for boxes and cylinders, it was a standard manual prim-torture technique to dimple a sphere (for example), then flip it to a box or cylinder with some of its Z extent removed.  For a time, that would work with scripts, too (hence, perhaps, the "legacy interface" reference?), but (AFAIK) they completely "fixed" that.  So that's why I resorted to describing the prim-carving process in Build Tool terms, rather than a script.

Nonetheless, in case we're still talking past each other, here's a script that will set the parameters I was talking about except slice, which will still have to be done in the editor ("begin" to 0.98, and "end" at the standard 1.00) after the script runs.

default{    state_entry()    {        llSetPrimitiveParams(            [ PRIM_TEXT, "Text", <1.0, 1.0, 1.0>, 1.0            , PRIM_SIZE, <0.5, 0.5, 0.01>            , PRIM_ROTATION, llEuler2Rot(<0.0, PI_BY_TWO, 0.0>)            , PRIM_TYPE, PRIM_TYPE_BOX                , PRIM_HOLE_DEFAULT                , <0.0, 1.0, 0.0>   // cut                , 0.0   // hollow                , ZERO_VECTOR   // twist                , <1.0, 1.0, 1.0>    //top_size                , <-0.5, 0.0, 0.0>    // top_shear            ]);    }}

If top_size is changed to, say, <0.3, 1.0, 1.0> and PRIM_SIZE to about <2.0, 0.5, 0.01>, and the slice again set to begin at 0.98, that taper brings the text pretty clearly beneath the remaining stuff of the prim.

Anyway, absolutely this trick is way more effective for a HUD than for anything rezzed in-world... and really that applies to hovertext in general, use of which in-world is a pretty desperate measure, pretty much always.

Link to comment
Share on other sites

Thanks very much for your in-world help, Qie.

It turns out that the above code still does not place the title at the "axis of the object", which means that it will not work any better than what I have now. 

The only solution, as Qie and I discussed, is a three-prim solution with the rotating prim separately Omega'd from the other two.

This also is dependent on how close you are to the prim, but with some care, can be made better than what I had already.

 

Thanks again, Qie.

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4336 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...