is vector3D in cube

Software: Away3D 4.x

Avatar
sebbdk, Jr. Member
Posted: 24 November 2011 11:41 PM   Total Posts: 39

how do i do this the simplest way in away 4.0 ?
i need accuracy so simply detecting distance wont do :|

just need a push in the right direction smile

   

John Brookes, Moderator
Posted: 25 November 2011 05:21 PM   Total Posts: 732   [ # 1 ]

In theory this should work

private function isVertexInOBB(mesh:Meshpos:Vector3D):Boolean
{
 
var mtx:Matrix3D mesh.sceneTransform.clone()
 
mtx.invert()
 
pos mtx.transformVector(pos);
 
 if (
pos.>= mesh.bounds.min.&& pos.<= mesh.bounds.max.&& pos.>= mesh.bounds.min.&& pos.<= mesh.bounds.max.&& pos.>= mesh.bounds.min.&& pos.<= mesh.bounds.max.z)
 return 
true;
 
 return 
false;
   

Avatar
sebbdk, Jr. Member
Posted: 25 November 2011 07:45 PM   Total Posts: 39   [ # 2 ]

I love you! thanks!
been trying to figure something like this out the intire week!
been driving me nuts, i knew there had to be a simple way to do it smile

That functions works just as intended smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X