Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - stormp

Pages: [1]
Support / How to Rotate Object relative to camera?
« on: November 04, 2007, 10:25:43 pm »
Hi again,

I'm trying to figure out how to rotate an object relative to the X Y axis of the screen space.

This *seemed* at first to almost work, but when I move the camera behind or under the object, I get inverse and / or reverse rotations - so I guess I'm way off here. :-(

Any suggestions?

Thank you,


Code: [Select]
public SimpleVector rotateRespect2Cam(float rotX, float rotY)
   SimpleVector dir = theCamera.getDirection();


   return dir.calcSub(theCamera.getDirection());

Code: [Select]
SimpleVector rotate = rotateRespect2Cam(delta.x * -camRotSpeed, delta.y * -camRotSpeed);

object.rotateX(rotate.x);  // rx rz ry to avoid gimbal lock.

Support / Scene Rotation
« on: October 28, 2007, 07:02:12 am »
Hi :-)

I'm looking for some pointers on how to mimic scene rotation similar to how GoogleEarth does.  IE: grabbing a point on a (imaginary) sphere and dragging that point around.

I found this article:

Is there any similar examples in jPCT?

Appreciate any help!




Still working on my grid lines.  ;D 

project3D2D wont render if "the center is behind the viewplane".   How can I adjust my vectors to clip at the approriate end?

Much thanks.


Code: [Select]
    private void drawLine(FrameBuffer fb, Graphics2D g, SimpleVector v1, SimpleVector v2)
        SimpleVector point1 = Interact2D.project3D2D(theWorld.getCamera(), fb, v1);
        SimpleVector point2 = Interact2D.project3D2D(theWorld.getCamera(), fb, v2);

        if(point1 != null && point2 != null)
            g.drawLine((int)point1.x, (int)point1.y, (int)point2.x, (int)point2.y);
        }  // if

Support / Using project3D2D & reproject2D3D
« on: July 18, 2007, 12:32:13 am »

I'm trying to draw a line that is 25 pixels away based on a position in my 3D scene but reporject2D3D seems to be not working for me.

Code: [Select]
vertex1 = new SimpleVector(centerX, topY, minZ);

// Get the point in 3D space and convert to 2D screen space.
point1  = Interact2D.project3D2D(theWorld.getCamera(), fb, vertex1);

if(point1 != null)                   
   // Add 25 to the screen X and convert back to 3D world space.
   vertex2 = Interact2D.reproject2D3D(theWorld.getCamera(), fb, (int)point1.x+25,  (int)point1.y, minZ);

vertex2 gives me back odd results.
Am I using this right?

Thanks for all the help thus far.


Support / poly clipping outside box.
« on: July 02, 2007, 06:25:03 am »
Hi, is there a way that I can clip the world outside a defined box?  That is, I want to define a box around my scene and only see the poly's that are contained inside the box no matter where I place the camera.

Thanks for any suggestions.


Support / maxPolysVisible ceiling in software render mode
« on: June 23, 2007, 08:23:20 am »

When in software render mode is there a ceiling limit to the number of visible polygons?  I've noticed in some examples maxPolysVisible is set to 10000 even 64000.

I get this error message intermittently:
Code: [Select]
WARNING: You've exceeded the configured triangle limit for the visibility list. Consider adjusting Config.maxPolysVisible!

I've set mine to         
Code: [Select]
Config.maxPolysVisible = 20000;
I'm never seeing any more than 3800 polygons in a scene
Code: [Select]
I really only have about 350 five faced cylinders randomly plotted in the world and a couple of planes. So there isn't really that many polygons to display in a scene.  Why would I be getting this error?

Also, what is a reasonable visible polygone count in a scene in software mode?  (I know this is a vague question, but just looking for some sort of guidelines or references).

Thanks for any help :-)


Support / plz help with Camera rotation aligned with orbiting object.
« on: June 17, 2007, 12:13:05 am »

I wanted to help visualize my camera movements / rotations as I was getting some strange results.

I have made a simple applet (source link included at the bottom) which has a small cube orbiting a larger cube.  the cube movements are manually controlled by pressing the arrow keys and you can toggle the camera by pressing 1 for follow mode 2 for free float and R to reset the cam to it's original position.

The little cube rotates around the cube if you press UP and DOWN.  If you press 1 to set the camera to follow behind the little cube, the rendering seems to mess up (inversed).

I've been searching on the forums for reference to this problem but I can't seem to figure out how to fix it.   :(

This seemed my best bet:,641.0.html
but when i tried to use the invert3x3() it didn't seem to work.

I also tried the "follower" code with the same result:,616.msg3214.html#msg3214

If anyone can help out I'd appreciate it greatly.


cube rotation:
Code: [Select]
if(mvSpinLeft)                            // Cube2 orbit left
     objCube2.rotateAxis(objCube2.getYAxis(), rotSpeed);
} // if

if(mvSpinRight)                           // Cube2 obrit right
      objCube2.rotateAxis(objCube2.getYAxis(), -rotSpeed);
}  // if

camera follow small cube:
Code: [Select]
      theCamera.setPositionToCenter(objCube2);                    // place camera inside cube2
      theCamera.align(objCube2);                                  // Copy the cube2 positive Z-axis.
      theCamera.lookAt(objCube1.getTransformedCenter());          // look at cube 1 center.
      theCamera.moveCamera(Camera.CAMERA_MOVEOUT, 50.0f);         // put camera behind cube2 a little

      // Problem is here?
}  // if


FULL SOURCE:  (in case it might be useful to someone in the future) :)

Support / building custom plane: is there an addTriangle() order?
« on: June 14, 2007, 11:24:20 am »

I was experimenting with building a custom plane.  Is there any order which the addTriangle() or the vectors must be added?

This works:
Code: [Select]
objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));

objSurface.addTriangle(new SimpleVector( 8.0f, -8.0f, 0.0f),
                       new SimpleVector(-8.0f, -8.0f, 0.0f),
                       new SimpleVector(-8.0f,  8.0f, 0.0f));

Where as this doesn't work:

Code: [Select]
objSurface.addTriangle(new SimpleVector(-8.0f, 8.0f, 0.0f),
                       new SimpleVector( 8.0f,  8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));

objSurface.addTriangle(new SimpleVector(-8.0f,  8.0f, 0.0f),
                       new SimpleVector(-8.0f, -8.0f, 0.0f),
                       new SimpleVector( 8.0f, -8.0f, 0.0f));

Can someone explain? :)


Support / newbie: how to make a 3d grid
« on: June 11, 2007, 11:46:59 am »
Hi, I'm a newbie to jPCT.

I would like to place objects inside a variable lined 3D grid.  As i zoom into the object, i would like the grid lines to become more detailed.

Can someone point me into the right direction on how to accomplish this using jPCT?

Thanks so much  :)


Pages: [1]