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 - doc.ios

#1
Support / 2D user interface in front of the 3D scene?
October 28, 2010, 07:22:15 PM
What is the jPCT-AE way of drawing buttons, text and UI stuff in front of the 3D scene?  A layer that doesn't move when the 3D stuff behind it does stuff.
#2
Support / ShadowHelper?
October 28, 2010, 06:58:16 PM
Sorry, dumb newbie question.  Tired and late too - so not too bright right now.

I wanted to put shadows in.  But I can't find the ShadowHelper class.  Is it included in the Android library?  What's the import path?  Or is there another recommended way to do shadows on an Android device?
#3
Support / Re: Collision detection
October 28, 2010, 09:48:07 AM
That was very helpful.  Thank you.

One more question.  I see I can check if the cube was the target of the collision, using cube.wasTargetOfLastCollision();  How do I check if the sphere has collided with something/anything ?  Without checking every potential target?  Or is this not something that can be polled?  An acceptable use of CollisionEvent perhaps?
#4
Support / Collision detection
October 27, 2010, 12:53:55 PM
I've been trying out jPCT today, and I can't figure out collision detection.

I started with the hello world for Android example.

I added another shape then moved one shape to collide with the other, and listened for collision.  At least I think so.  I haven't seen any examples or tutorials to do with collision (Can anyone point me to something?).  And I'm just picking out methods from the javaDocs that look like they'll do the trick.

With my two shapes, I do the following:-


cube.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
cube.setCollisionOptimization(true);
cube.addCollisionListener(this);

sphere.translate(20, 0, 0);
sphere.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
sphere.setCollisionOptimization(true);
sphere.addCollisionListener(this);


Alright, I suspect I don't need to set BOTH shapes up, but I was trying to get it working.

I've implemented CollisionListener, and written:-


public void collision(CollisionEvent arg0) {
    Logger.log("collision");
}

@Override
public boolean requiresPolygonIDs() {
// TODO Auto-generated method stub
return false;
}


Then within the game loop, I just move the sphere towards the cube...


  sphere.translate(-0.5f,0,0);


And also tried moving the camera with checkCameraCollisionSpherical/Ellipsoid, but it didn't stop at the obstacle.

I don't understand the way slideMode id described anyway.  Does this mean it will stop at the obstacle, and slide no further?  Or not move (slide) if there is an obstacle in the way?

I know there's a similar scheme for moving an object (instead of using translate).  To stop at an obstacle.  Can anyone point me at an example?