Author Topic: Object translation clarification  (Read 1025 times)

Offline gamerfan

  • int
  • **
  • Posts: 97
    • View Profile
Object translation clarification
« on: July 01, 2011, 04:02:23 pm »
I am further understanding this rotation and camera movement of collisionDemoSoftware.This time I have added the code for moving the cube along Y-axis.And this is the following code I have added.But what happens is that the camera itself is moving up and the cube disappears.
Code: [Select]
if(keyA) {
                    SimpleVector t = cube.getYAxis();
    t.scalarMul(SPEED);
    moveRes.add(t);
                    moveRes = cube.checkForCollisionEllipsoid(moveRes, ellipsoid, 8);
                     if(moveRes.y < 0) {
                         System.out.println(" less than zer0....");
                         cube.translate(0, 0.25f, 0);
                     }   
                     else {
                        cube.translate(moveRes);
                     }
                   
                    cube.translateMesh();
                    cube.clearTranslation();
                }
I have added the above two lines. But the cube is not moving along y-axis, similarly the way it is moving along z-axis. Instead of that, the camera itself is moving up as I described earlier.What exactly I am missing here?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12060
    • View Profile
    • http://www.jpct.net
Re: Object translation clarification
« Reply #1 on: July 01, 2011, 04:28:35 pm »
That's because the coordinate system that jPCT uses isn't the one that you seem to expect: http://www.jpct.net/wiki/index.php/Coordinate_system

Offline gamerfan

  • int
  • **
  • Posts: 97
    • View Profile
Re: Object translation clarification
« Reply #2 on: July 04, 2011, 08:51:54 am »
It woked  well !!!. Now I am trying to understand this API. Thanks for your assistance.