- Home /
Question by
Ravi M L · Dec 04, 2012 at 07:09 AM ·
objectcoordinates
How to put Object in the perticular Location?
I want to place cube using four reference points. The reference points would be Bottom Left = (0,0) bottom Right = (5,0) Top Left = (0,5) Top right = (5,5)
How to put cube corners exactly fits in above mentioned points.
Is it possible in unity to place the Objects using coordinate points ?
Please guide me regarding this..
Sorry for my bad english ..
Thank you in advance.
Comment
Try something like (pseudo code):
Vector3 tl=...
Vector3 tr=...
Vector3 bl=...
Vector3 br=...
transform.position = (tl + tr + bl + br) / 4.0f;
Best Answer
Answer by moghes · Dec 04, 2012 at 01:34 PM
I understand that the cube you want to locate has each side of 5 units. thus you can figure the position of the center of the cube. which is 2.5 for all dimensions.
you must be using transform.position = Vector3(2.5, 2.5, 2.5);