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.

Messages - haijin

Pages: 1 2 [3]
Support / Re: null pointer at world 1021
« on: May 23, 2011, 11:59:20 am »
the onTouchEvent initializes the world (with its contents) and starts the ticking thread. The ticking thread modifies the world and then requests a redraw. The error happens even if I sync tick and draw. Any chance of learning what's in line 1021?

Support / Re: null pointer at world 1021
« on: May 23, 2011, 11:49:14 am »
yes, I've seen it's not thread safe, and I'm still not sure it relates to a threads problem. The thing is that I always initialize the world and then execute the onDraw (render when dirty) so it shouldn't be directly related to threads... that's why knowing what that line does might help.
Note that the draw is always performed after world manipulation (ticking loop ends with redraw), so no thread problem here (and I've even synchronized the tick/draw blocks, just in case). And, as I said, starting the ticking/drawing at a different spot does work as usual (that's why I suspected a link to onTouchEvent/other thread).

Support / Re: null pointer at world 1021
« on: May 23, 2011, 11:25:48 am »
that's my code calling world.renderScene, which leads to the null pointer in line 1021 of class World

Support / null pointer at world 1021
« on: May 23, 2011, 10:54:51 am »

I'm getting a Null pointer in World class, line 1021, but only when I setup the world contents at certain point in the code. Might be about the different threads (i.e. onCreate works, onTouchEvent fails) but there might be something else going on, I still can't find the reason. It might help to know what's happening at that line in class World (I think it's version 1.22, downloaded about a month ago).
Here's the exception...
E/AndroidRuntime(14758): FATAL EXCEPTION: GLThread 8
E/AndroidRuntime(14758): java.lang.NullPointerException
E/AndroidRuntime(14758):        at com.threed.jpct.World.renderScene(
E/AndroidRuntime(14758):        at
E/AndroidRuntime(14758):        at android.opengl.GLSurfaceView$GLThread.guardedRun(
E/AndroidRuntime(14758):        at android.opengl.GLSurfaceView$

... so, what's the world like in 1021?

Support / Re: Understanding collisions in 3D
« on: May 01, 2011, 09:48:07 pm »
Yes, I first assumed the collision was done on world coordinates but, when my implementation didn't work and after looking around the forums, I messed up and went off the right path :) the issue was not setting the collision mode right... I'll try to post some real problem next time :P

Support / Understanding collisions in 3D
« on: May 01, 2011, 02:23:01 pm »
Ok, solved... the second (preferred) alternative works. It's just that I wasn't setting the collision mode to SELF (only OTHERS). Still not sure about the use of the axis vectors...
Hi, this is my second post, and it's about time to thank the developers on their effort to create an easy and comfortable 3D engine. After a project directly working with opengl (Trapped, for Android), this is a welcomed change.
That said, my 3d math knowledge is quite limited and conflicting with implementation of collisions. I am working on a top down view game with NPCs trying to catch the main character. Now I want to have the NPCs avoid each other (i.e. no overlapping) when stalking the player.
I first tried without checking the corresponding examples, sending to checkForCollisionSpherical() the transformation that I would send to translate() (thinking the collision would be based on the transformed position, but also trying to add the current transformed position). Seeing that wouldn't work I checked the wiki and I see the use of getX/Z/YAxis() which I don't quite understand, still tried to implement it, obviously with no success... here's the alternatives I have tried:
Code: [Select]
       if (false){
            SimpleVector center = getTransformedCenter();
            SimpleVector t = new SimpleVector(speedX + center.x, speedY + center.y, center.z);
            SimpleVector avoid = checkForCollisionSpherical(t, 5f);
            if (avoid.equals(t))
                translate(speedX, speedY, 0);
        if (false){
            SimpleVector avoid = checkForCollisionSpherical(new SimpleVector(speedX, speedY, 0), 5f);
        if (true){
            //SimpleVector move = new SimpleVector();//getTransformedCenter();
            SimpleVector t = getXAxis();
            t = getYAxis();
            move.z = 0;

            move = checkForCollisionSpherical(move, 5f);
any hints/links/explanations on how this works would be appreciated...

Support / Md2 animation on Android problem [solved]
« on: April 29, 2011, 06:11:27 pm »
[Just before posting this I had a last shot, thinking it might be the strip() call (which prevents future modification). It wasn't that but the compile() call, which I also commented, because... well, had to try. So the conclusion is not to call compile if you have animations... I saw on the docs that it's not meant to be called, kind of a legacy method or something but no further explanation. If somebody wants to add the reasoning, that would be great.
I just went ahead and posted this because it might be handy to some, point a possible problem or well... just as a Hello World!]


I've just started with jpct and I'm having trouble getting the animations to work on Android. The md2 model loads fine, it displays properly and transformations apply, but the animation just won't work. I've followed the advanced example, the logs says it processes the animations (stand, run, etc...) but the mesh doesn't change... also tried a couple of md2 files, with same results...
Here's the code... but I can't see any relevant difference to the examples:
Code: [Select]
[...] on creation
        try {
            zombie = Loader.loadMD2(ctx.getResources().getAssets().open("zombie.md2"), 0.1f);
            zombie.translate(0, 7, -3);
            zombie.rotateX((float) (-Math.PI / 2));
            zombie.rotateZ((float) (Math.PI / 2));
            zombie.compile();// SOLUTION: that line was the problem, so just remove this line!
        } catch (IOException ex) {
            Logger.getLogger(GameRenderer.class.getName()).log(Level.SEVERE, null, ex);
[...] on draw
    float anim = 0;
    public void onDrawFrame(GL10 gl) {
        if (running){
            zombie.animate(anim, zombie.getAnimationSequence().getSequence("stand"));
            anim += 0.1;
            if (anim >= 1)
                anim = 0;
        } else

Any ideas on what's the problem?

Pages: 1 2 [3]