playMaker

Author Topic: Create Object position is off  (Read 2480 times)

Laralyn

  • Playmaker Newbie
  • *
  • Posts: 21
Create Object position is off
« on: September 23, 2013, 10:09:27 PM »
I've got a simple loop that starts with x = 1, z = 1 and cycles rows and columns up to x=24, z=24. It converts each int into a float, sticks the floats into a vector3, then creates a cube based on a prefab and sets the position of the created cube at the vector3.

The end result has each cube off by just a little bit visually--even though the positions in the editor say they are only different by 1. They also all come in at Y = -4 even though the Y position in the vector is set to 0. And, to make things even more confusing, they come in with the Y scale as .9999999.

Here's an image that shows the cubes not lining up correctly.



I've checked the prefab being used, and it's set to loc 0, 0, 0 and a scale of 1, 1, 1. What could be causing this?

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Create Object position is off
« Reply #1 on: September 24, 2013, 05:58:37 AM »
Hi,

They may be slightly rotated.

Scal of .999999 is fine, it's just Unity and they way it display float. .999999 means 1, like if you see 1.94e2232 that means 0... I know...

You need to check the position rotation and scale of the prefba instances, not the prefab itself.

bye,

 Jean

Laralyn

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Create Object position is off
« Reply #2 on: September 25, 2013, 12:00:40 PM »
I've got screen shots at runtime that should help explain what's going on. In this first shot, you see a cube that's clearly out of alignment (sticking out a bit instead of forming a seamless wall). You can also see the coordinates of the cube I've selected.



Here's the second cube in that wall selected. You can see the only change in the coordinates is that the Z is 1 higher. The X and Y are exactly the same. Yet the cube is clearly a bit off on the X.



Making sure the rotation and scale are exactly 1.0 does not fix the problem.



If I adjust manually so the cubes are visually aligned, this is what the new coordinates look like--with the X slightly different from the previous cube.



Hopefully this explains why I'm so confused. It seems like taking a 1x1x1 cube and placing it in a loop that offsets first the X and then the Z by 1.0 should create seamless rows... but it's not. I get the exact same strange results if I use a newly created cube at 0, 0, 0 in the loop rather than the prefab.
« Last Edit: September 25, 2013, 02:12:47 PM by Laralyn »

Laralyn

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Create Object position is off
« Reply #3 on: September 25, 2013, 12:12:22 PM »
I created a sample Unity project. All it does is replicate a cube on a loop, offset by 1 X and 2 Z (so you can move the camera between the rows and look at the alignment). It has the same problem. You can download it here: http://www.eluminarts.com/cubetest.zip.

Hopefully that helps make it more clear!  :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Create Object position is off
« Reply #4 on: September 27, 2013, 02:49:16 AM »
Hi,

 yes, simply uncheck none in the rotation, and you leave it as a vector 0,0,0 and it will be fine.

 I have reported this as a bug, leaving to none should not have this effect of setting the axis rotation to 1.

Bye,

 Jean