Main Menu
Menu

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.

Show posts Menu

Messages - culli

#1
Bugs / checkCollision
July 01, 2006, 05:10:35 AM
I had this problem too with a small object I am putting together with addTriangle.  I just couldn't get the collision detection to work, so I tried a plane too.  That didn't work either, until I flipped the plane over.

Object3D aPlane = Primitives.getPlane(4, 5);
aPlane.rotateAxis(aPlane.getXAxis(), (float)Math.PI/2);
aPlane.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
aPlane.setTexture("wood");
aPlane.build();
theWorld.addObject(aPlane);
SimpleVector cameraPosition;
cameraPosition = aPlane.getCenter();
cameraPosition.y = cameraPosition.y - 40;
cameraPosition.z = cameraPosition.z - 65;
camera.setPosition(cameraPosition);
camera.lookAt(aPlane.getCenter());
...
SimpleVector testMove = someObject.getTransformedCenter();
SimpleVector dir = new SimpleVector(0, -5, 0);
int collisionObject = theWorld.checkCollision(testMove, dir, 10);
Camera camera = theWorld.getCamera();

Results in: collisionObject == Object3D.NO_OBJECT
but if I rotate the plane the opposite way:
aPlane.rotateAxis(aPlane.getXAxis(), -(float)Math.PI/2);
it works.  However, the texture does not display, it is on the side of the plane away from the camera.

:?: Just curious, why does flipping the plane over the other way fix this?  Normals, aabbs, or something else?

Thanks,
Jim
#2
Support / Spam killer
June 02, 2006, 03:28:38 AM
That looks great!  Good luck building a spam robot to identify farm animals or distinguish kittens from lions.  They might do it, but it will be a LONG time.

Thanks!
Jim
#3
Support / FrameBuffer
May 24, 2006, 03:02:23 AM
See the demos, feel the demos, be the demos.

I'm not trying to be rude here, this is meant to be constructive criticism.  You might be in over your head.  Maybe you should try some easier programs for awhile.  3D programming is not a good way to learn Java and you are showing by your questions that you don't know Java yet.  Myself and others have posted a lot of good information about how to get started with Java and JPCT, yet you don't seem to follow the instructions.  Maybe I'm wrong...

Good Luck :) ,
Jim
#4
Support / 3d engine
May 21, 2006, 06:52:27 AM
What packages have you imported?  You use JPCT the same way.

So I think I saw in a another post you said you installed NetBeans?  You need to try to get the demos that come with JPCT compiling and running: the car demo and the FPS demo.  I don't use NetBeans, but basically you need to create a project and add the source files for one of the demos.  You need to configure your project -- however that's done in NetBeans -- so that it includes the necessary .jar files for JPCT and LWJGL.  Try to do that much and ask a specific question if you get stuck.  (By specific I mean something like: What modes does FrameBuffer.enableRenderer() support?)

Once you get the demos working, look at their code and try messing around with making other objects show up or modifying them in some way.

Have a good long read of http://www.jpct.net/doc/  You'll be using those classes to get anything done with JPCT.
#5
Support / 3d engine
May 20, 2006, 06:16:12 AM
Let me give a broad answer:

From someone who is a beginner with JPCT, I'll say first you need to know Java.  I know Java because that's what I used primarily in university, and now I use it professionally too.  If you don't know Java, go write a 2D tic-tac-toe game in text mode or something very simple first.  Write a bunch of small programs in Java.  Read some books like "Thinking in Java" http://www.planetpdf.com/developer/article.asp?ContentID=6632  (this is 3rd edition, or buy the 4th edition), or for an example list of beginner Java books: http://www.amazon.com/exec/obidos/tg/browse/-/3612/ref=dp_brlad_entry/103-8344784-0027869.  Browse the web for beginner courses on Java, maybe even go sign up for some courses if you have a university or community college nearby.

When you feel like you know your way around the Java API, that is, when you feel like you understand how to build a basic java program and import and use other people's classes, go follow the JPCT manual: http://www.jpct.net/manual2/index.html

Try to do some of the steps, then ask more questions when you get stuck.

Hope this helps,
Jim
#6
Support / Screen shot
May 20, 2006, 05:56:04 AM
Here's a picture of my simple application:



As you can see, I'm making chinese checkers.  

When the mouse is over the pieces, they turn white.  If you click and drag the pieces, they'll move around the board.  They have no texture but the default Object3D texture assigned, plus the addtional color.  

Anyway, this seemed a good thing to start with because it has only a few rules, it has hex tiles which are good for war simulation games later, and I can do a bit of AI with it.  The model for the board has very few triangles and I'm still learning how to map the texture correctly, but it's not so important to me right now.  I'm more interested in the game play, what little there is.  I had a lot of the game logic done a while ago, now I'm finding problems with my hex tile representation.  I don't spend very much time on this, so it's going slowly.
#7
Support / Color with no texture
May 20, 2006, 01:03:04 AM
Have you tried Object3D.setAdditionalColor?  It works well for me:


public Piece3D(Color color) {
       super(Primitives.getCylinder(10, 1, 0.5f));
       this.setAdditionalColor(color);
       build();
}

...
Piece3D singlePiece = new Piece3D(new Color(255, 255, 0));
...


I also use this for highlighting the pieces when the mouse pointer is over them.

If you want, I can send a screenshot to make sure we're talking about the same thing.
#8
Support / hang during texture load
May 17, 2006, 02:55:18 AM
Don't know what platform you're developing on, but check out the Eclipse debugging and profiling stuff:
http://www.eclipsezone.com/eclipse/forums/t44632.html
http://www.theserverside.com/tt/articles/article.tss?l=EclipseProfiler

or try JProbe (commercial product, but free trial with registration...) http://www.quest.com/jprobe/

Also try running your program from a console, then pressing ctrl+break after it hangs to get a thread dump.

Regards,
Jim
#9
Support / Spam
May 16, 2006, 02:12:25 PM
Great!  I hate spam.  

Wow, I didn't know there were perl scripts that could read those images.  I thought that would be a more difficult thing to do.  Guess it just proves that there are a lot of smart (yet evil) people out there.

You are right that there must be people that order from the spam sites or they would not keep sending out the spam bots.

Grr.
#10
Support / Spam
May 16, 2006, 04:34:29 AM
May I suggest you enable "visual confirmation" for forum registrations?  The spam is just starting.  It'll get much worse.   :x

Thanks,
Jim
#11
Support / Solved!
May 13, 2006, 11:04:39 PM
:idea:  :idea:  :idea:

Ok, I have this working, thanks to Egon, Andrei, and others.

The problems with my code were:

It was generally disorganized.  (it still is, but less now)

The mesh I'm sticking my pieces to was upside-down.  Rotating it +PI/2 instead of -PI/2 fixed that. :oops:

I was abusing translateMesh().  I shouldn't have been using it at all, at least for most things. :roll:

Andrei's code http://www.jpct.net/forum/viewtopic.php?t=226 for getting an absolute position on a surface worked beatifully on a primitive plane, which is when I discovered that things were upside down.  :D

Thanks guys!

Now I can move on to be confused about other things.

Jim
#12
Support / Dragging objects
April 30, 2006, 10:35:06 PM
Hi, I've been lurking on here for a while and toying with things.  I really like the way JPCT feels.  

Now I'm trying some ideas for a game where part of it is an RTS (starcraft-style) where you're looking down at a terrain and can drag objects around.  To simplify the idea, I'm treating it like checkers.  I want to click and drag a piece from one position to another.  There have been some great things in the forums that have helped with other problems I've had, but the one I can't figure out right now is that the piece doesn't "keep up" with the mouse cursor.  I can scalarMul the ray to help the problem some, but I want it to keep up exactly with the mouse.

Can't say my vector math skills are more than beginner, but I'm reading some books and learning.

Here's what I've got right now in the "mousedragged" event:

(lastPiece is selected on mouse moves)



SimpleVector currentRay = Interact2D.reproject2D3D(theWorld.getCamera(), buffer, e.getX(), e.getY());
               
currentRay.normalize();
//deal with the camera space
Matrix orient2 = theWorld.getCamera().getFront();
float[] dump2 = orient2.getDump();
SimpleVector ray2 = new SimpleVector();
ray2.x = dump2[0] * currentRay.x + dump2[1] * currentRay.y + dump2[2] * currentRay.z + dump2[3] * 1;
ray2.y = dump2[4] * currentRay.x + dump2[5] * currentRay.y + dump2[6] * currentRay.z + dump2[7] * 1;
ray2.z = dump2[8] * currentRay.x + dump2[9] * currentRay.y + dump2[10] * currentRay.z + dump2[11] * 1;
               
ray2.y = lastPiece.getOrigin().y;
ray2.scalarMul(50);
lastPiece.setOrigin(ray2);
lastX = e.getX();
lastY = e.getY();


What am I doing wrong?

Thanks,
Jim
#13
Support / native libraries
March 11, 2006, 03:22:47 AM
Instead of putting them in a specific folder, tell java where they are like Egon said.  See http://www.lwjgl.org/installation.php.

I have jpct working in both Eclipse on Windows XP and IntelliJ on Suse 9.2 using the -D parameter for the LWJGL dll's and so's.