playMaker

Author Topic: Making a float a whole number [SOLVED]  (Read 2418 times)

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Making a float a whole number [SOLVED]
« on: August 11, 2013, 10:10:50 AM »
Hi,

I am trying to create a grid system based off set row and column variables.

As such I need to set grid object to specific vector 3s

to do this I add  an int of +1 in a loop to represent the x position for rows, then convert that int to a float to input that into the vector 3's x position and so on to create a series of objects next to each other.

I do the same process but with z to create columns.

It all works well, but due to vector 3s needing float values, I must convert my ints to floats then input them. this however creates really annoying slight inaccuracies in the x and z coordinates so that my grid is ever so slightly off.

is there a way to convert a float to its closes whole number?


cheers,

jasper
« Last Edit: August 12, 2013, 08:55:40 AM by jasperPT »

lalamax3d

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Making a float a whole number
« Reply #1 on: August 11, 2013, 01:17:31 PM »
"convert float to int"  from actions. hopefully should work

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Re: Making a float a whole number [SOLVED]
« Reply #2 on: August 12, 2013, 08:55:24 AM »
ahh yes you are correct!

Turns out it was to do with rotation issues rather than position because I had not set the specifi rotation value.

Thanks for the help!