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 - Musurca

Pages: [1]
Support / Ray/polygon collision
« on: May 09, 2004, 10:29:59 am »

First of all, thanks a ton for adding that PolygonManager class in the latest release. That was a huge help.

On to the next problem, unfortunately: it seems that the ray/polygon collision methods (Object3D.checkForCollision(SimpleVector, float)) work very inconsistently. Collisions occur very rarely, and there doesn't seem to be any way of predicting when the method will work.

For instance, I can fire a projectile at a wall, calling checkForCollision each frame with the projectile's direction vector and the amount by which it moves during that frame. However, the collision is hardly ever registered. The sphere and ellipse collision methods work perfectly, but clearly I don't want to be doing full ellipsoid collision detection for a hundred small projectiles flying around the screen. Do you have any suggestions?



Support / Interact2D not using camera transform
« on: April 26, 2004, 11:37:09 pm »
I've been implementing picking in my jPCT application, and I've come across the following problem: a ray created with reproject2D3D(...) from X and Y screen coordinates chosen by the mouse does not take into account the camera's transform. I have to manually multiply the ray by the camera's front matrix like so:

Camera cam;
FrameBuffer buffer;


SimpleVector rayTemp = Interact2D.reproject2D3D(cam, buffer, mX, mY);
Matrix orient = cam.getFront();
float[] dump = orient.getDump();
SimpleVector ray = new SimpleVector();
ray.x = dump[0]*rayTemp.x + dump[1]*rayTemp.y + dump[2]*rayTemp.z + dump[3]*1;
ray.y = dump[4]*rayTemp.x + dump[5]*rayTemp.y + dump[6]*rayTemp.z + dump[7]*1;
ray.z = dump[8]*rayTemp.x + dump[9]*rayTemp.y + dump[10]*rayTemp.z + dump[11]*1;

If I don't do this, the ray has entirely the wrong orientation. Is this intentional behavior, or am I just doing something wrong?



Support / 3D points/lines and polygon normals
« on: April 04, 2004, 03:07:23 am »

I just started using jPCT last week, and I'm really impressed with it. Have you ever worked with the (now defunct) Spacecrafter 3D API? jPCT seems very similar to it, albeit far more powerful.

There are a couple features, however, that I'd like to add to my project, and I wasn't sure how to go about implementing them.

3D points/lines:
I'd like to be able to draw single-pixel points or lines in world-space for particle effects and such. I could just convert 3D points to screen space and draw them directly using the Graphics structure, but then they wouldn't take the Z-buffer into account and wouldn't be occluded by other objects. If there's no clever way to do this, would you be willing to add simple point/line drawing methods to the next release?

Polygon normals:
My game uses terrain generated from image-based heightmaps, and I'm using calcMinDistance() to find an object's height from its 2D position on the grid. However, I'd also like to change the object's orientation based on the contours of the terrain. I could call calcMinDistance() a couple more times from different points on the object to recalculate the normal, but this seems wasteful. I suppose I could also misuse the pickPolygon() method and a VertexController, but the polygon in question won't necessarily be visible to the camera. Would it be possible to add a method similiar to calcMinDistance() that returns information about the polygon struck by the ray and its normal?

Thanks in advance,


Pages: [1]