Notifications
Clear all

[Closed] Float Number display issue

Hi, folks! I’m trying to develop some little tools for creating some facial controls to a character. I’m wondering a nice way to get, via PickPoint function, the index of a vertex, so from there I can build some stuff.

I want to do it, first, in the most simple way (I'm still learning script), so I thought I could use meshOps to get the vertex count, vertex indexes and vertex positions -in an array-, and then using [b]findItem [/b]to match the position taken by PickPoint with the desired one, and then getting the vertex index.

But, what happens then? FindItem function does not work right, because as stated in MAX help...

[left] 

When you display or print a Float, MAXScript prints the value to the 6th significant digit. The following table shows examples of values stored to a MAXScript variable, the value as stored, and the value as displayed.

      [left][b][b]Input  Value / Stored  Value / Displayed Value[/b][/b]

[/left]
[left]1.23456789 / 1.23456788 / 1.23457
[/left]
[left]1.1 / 1.10000002 / 1.1
[/left]
[left]1.01 / 1.00999999 / 1.01
[/left]

… so the displayed float number is not the same as the stored one. So the question would be if you know if this could be ‘tricked’ in some way. I took a look at the preferences and I’ve found nothing about the decimals displayed, neither in the MAXScript Help File.

Thanks for your time!
[/left]

1 Reply

Hi again! Although I want to know something about the question I did, I found something that works fine for me, and returns the index of the vertex I’m looking for:


 vertexNumber = $Teapot01.verts.count
 vertsArr = $Teapot01.verts

myPos = 
   (
  	 for i =1 to vertexNumber collect vertsArr[i].pos as string
   )
 
lookedPos = pickPoint prompt:"Pick a vertex" snap:#3D as string
 
 findItem myPos lookedPos

Bam! It works like a (dirty) charm