How to get mid point of lower egde of cude

how can I get midpoint of lower Edge’s of Cube which placed on the plane , Actually I want to roated the cube around point any direction which basic on in which direction I swipe so how to get the mid point of lower edge of cube. On each rotation it change it lower sop can I calculated tht mid point

Thanks in Advance
–Kapil

How excatly pro is as show in Fig . i;m not able to get on which on surface cube is place . if i got that than only can evalte corrent mid point of lower eage469962–16490–$Cube.bmp (154 KB)

Those aren’t actually cubes (they’re rectangular cuboids, or ‘boxes’).

To get the midpoint of an edge, you need the center of the box, the three basis vectors that define its orientation, and the extents in each dimension (half-width, -height, and -depth). The center and basis vectors can be queried from the transform component for the game object (assuming these objects are represented using a game object), and the extents can come from wherever (presumably you know the dimensions of the boxes in question).

Here’s an example of how to compute one of the edge midpoints (untested):

Vector3 mid = center + xAxis * xExtent + yAxis * yExtent;

All of the 12 midpoints can be computed in a similar manner (which axes are used and the signs of the axes will determine which midpoint is returned).

Note that another (equivalent) option would be to use Transform.TransformPoint() to transform the local-space edge midpoint to world space (which is essentially what the code excerpt above does).

Hey Jesse How can i Integrated that keyboard Control to Iphone Touch joystick control , As Unity Given Car tutorial i want to convert that car in to iphone touch joystick

I’m afraid I don’t understand the question.

Well mean The Car tutorial Which Unity Given with keyboard Control on Horizontal and Vertical By get Axis . i want to convert that game control to iphone joystick .

Still not quite sure what you mean. In an earlier post you’d referenced a puzzle game involving rotating rectangular cuboids, but I’m not sure how that would relate to a car tutorial (or what car tutorial you’re referring to, for that matter).

Sorry I can’t be of more help. Maybe someone else will be able to help out, but I think if you could find a way to explain your question more clearly, you might get some better feedback.

Hey Jesse Thanku Very much for your support i get over that puzzle game yes in that game their is car which in running on track . On Track i use to place cuboids which have to rotated to clear path for car to reach Designation. Well what i exactly want to Do, i had seen Unity Car Tutorial . Their is car which in Running on keyboard. Control . i only Want to use that Car prefabs in may game. That is what i’m Doing .
Thank u very Much jesse for u support that really help for me!!

– kapil!