Revision: 8854
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8854&view=rev
Author:   hsujohnhsu
Date:     2010-08-12 18:32:32 +0000 (Thu, 12 Aug 2010)

Log Message:
-----------
make contact markers more visible

Modified Paths:
--------------
    code/gazebo/trunk/server/physics/PhysicsEngine.cc

Modified: code/gazebo/trunk/server/physics/PhysicsEngine.cc
===================================================================
--- code/gazebo/trunk/server/physics/PhysicsEngine.cc   2010-08-12 18:31:45 UTC 
(rev 8853)
+++ code/gazebo/trunk/server/physics/PhysicsEngine.cc   2010-08-12 18:32:32 UTC 
(rev 8854)
@@ -52,14 +52,14 @@
   {
     this->visual = 
OgreCreator::Instance()->CreateVisual("Physics_Engine_Visual");
     this->visual->SetVisible(false);
-    this->contactLines.resize(100);
+    this->contactLines.resize(5000);
 
     Material *mat = new Material();
     mat->SetName("ContactPointsMaterial");
     mat->SetPointSize(10);
-    mat->SetAmbient(Color(1,1,0,1));
-    mat->SetDiffuse(Color(1,1,0,1));
-    mat->SetEmissive(Color(1,1,0,1));
+    mat->SetAmbient(Color(1,0,0,1));
+    mat->SetDiffuse(Color(1,0,0,1));
+    mat->SetEmissive(Color(1,0,0,1));
     std::string matName = OgreCreator::CreateMaterial(mat);
 
     unsigned int i=0;
@@ -71,6 +71,20 @@
           OgreDynamicRenderable::OT_LINE_LIST);
       (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
       (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
+      (*this->contactLinesIter)->AddPoint(Vector3(0,0,0));
       (*this->contactLinesIter)->setMaterial(matName);
       this->visual->AttachObject(*this->contactLinesIter);
     }
@@ -182,9 +196,30 @@
   if (!World::Instance()->GetShowContacts())
     return;
 
-  (*this->contactLinesIter)->SetPoint(0, pos);
-  (*this->contactLinesIter)->SetPoint(1, pos+(norm*0.1));
+  Vector3 e1 = norm.GetPerpendicular(); e1.Normalize();
+  Vector3 e2 = norm.GetCrossProd(e1); e2.Normalize();
 
+  (*this->contactLinesIter)->SetPoint( 0, pos);
+  (*this->contactLinesIter)->SetPoint( 1, pos+(norm*0.2)+(e1*0.05)+(e2*0.05));
+  (*this->contactLinesIter)->SetPoint( 2, pos);
+  (*this->contactLinesIter)->SetPoint( 3, pos+(norm*0.2)+(e1*0.05)-(e2*0.05));
+  (*this->contactLinesIter)->SetPoint( 4, pos);
+  (*this->contactLinesIter)->SetPoint( 5, pos+(norm*0.2)-(e1*0.05)+(e2*0.05));
+  (*this->contactLinesIter)->SetPoint( 6, pos);
+  (*this->contactLinesIter)->SetPoint( 7, pos+(norm*0.2)-(e1*0.05)-(e2*0.05));
+
+  (*this->contactLinesIter)->SetPoint( 8, pos+(norm*0.2)+(e1*0.05)+(e2*0.05));
+  (*this->contactLinesIter)->SetPoint( 9, pos+(norm*0.2)-(e1*0.05)+(e2*0.05));
+
+  (*this->contactLinesIter)->SetPoint(10, pos+(norm*0.2)-(e1*0.05)+(e2*0.05));
+  (*this->contactLinesIter)->SetPoint(11, pos+(norm*0.2)-(e1*0.05)-(e2*0.05));
+
+  (*this->contactLinesIter)->SetPoint(12, pos+(norm*0.2)-(e1*0.05)-(e2*0.05));
+  (*this->contactLinesIter)->SetPoint(13, pos+(norm*0.2)+(e1*0.05)-(e2*0.05));
+
+  (*this->contactLinesIter)->SetPoint(14, pos+(norm*0.2)+(e1*0.05)-(e2*0.05));
+  (*this->contactLinesIter)->SetPoint(15, pos+(norm*0.2)+(e1*0.05)+(e2*0.05));
+
   this->contactLinesIter++;
 
   if (this->contactLinesIter == this->contactLines.end())


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to