Is there a method to calculate distances between two 3d objects?
Did a search, ,but couldn’t find it.
Thanks for any help!
calculating distance between 3dobjectsSoftware: Away3D 4.x |
||
maddog, Sr. Member
Posted: 23 November 2011 01:21 AM Total Posts: 118 |
||
Alex Bogartz, Sr. Member
Posted: 23 November 2011 01:39 AM Total Posts: 216 [ # 1 ] Just take their position object and grab the x, y, and z of both objects. Then: distance=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))+((z1-z2)*(z1-z2))) Make sure each model is centered when you export. |
||
|
||
maddog, Sr. Member
Posted: 23 November 2011 05:56 AM Total Posts: 118 [ # 3 ] It seems I have a problem getting distances. The model is a Rubik cube and I have aligned all the cubes origin to the center of the stage in blender. This makes it so when I go to rotate a side it will rotate like a actual Rubik cube rotates. The problem is, I need to get the distance of each cube to each of the sides centers cube. So when i goes to rotate a side i rotate the right cubes according to how close they are to the center cubes. I have made up version where the origins are set to each cube of the Rubik cube, but I think it would be impossible to solve once you mess it up enough. here is with origins set to center of each cube here is with origins set to center of stage just click on center cube for each side. Any Ideas how I could still calculate distances would be great. |
||
|
||
|
||
Jack Dracon, Newbie
Posted: 28 November 2011 12:17 PM Total Posts: 27 [ # 6 ] Hey, |