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

Pages: 1 [2] 3 4 ... 15
Support / Wall Collision
« on: August 12, 2017, 12:10:26 am »
I'm trying to use the following code. In this case, the walls and the floor are different entities. Collision with the floor is handled separately and works fine. When I do get a collision with the walls, which is not always, I get printouts like "Collided and not with ground. Direction: (-7.939828, -2.0494497) Return route: (5.188492, -2.2546387)." Why would I not at least get the reverse of my direction? How should I do this, instead?

In loop():
Code: [Select]
     camera.moveCamera(Camera.CAMERA_MOVEIN, MOVE_SPEED);

Code: [Select]
    private void wallCollision(float MOVE_SPEED) {
SimpleVector cameraZ = camera.getZAxis();
SimpleVector direction = new SimpleVector(cameraZ.x*MOVE_SPEED, cameraZ.y*MOVE_SPEED, cameraZ.z*MOVE_SPEED);
SimpleVector newDirection = collide(direction);
     private SimpleVector collide(SimpleVector directionToHead) {
SimpleVector direction = theWorld.checkCollisionEllipsoid(camera.getPosition(), directionToHead, ELLIPSOID_RADIUS, 5);//.5f, 2f, .5f), 5
if (directionToHead.x != direction.x || directionToHead.z != direction.z) {
     float multiplier = 1f;
     direction.x*= multiplier;
     direction.z*= multiplier;
System.out.println("Collided and not with ground. Direction: ("+directionToHead.x +", "+directionToHead.z +") Return route: ("+direction.x +", "+direction.z +").");
     camera.moveCamera(direction, 1f);
return direction;

Support / Only thing rendered is the SkyBox
« on: June 11, 2017, 02:11:43 am »
And even that won't turn with the camera. The screen is being redrawn, the accelerometer data is being updated, and so on and so forth. onDrawFrame calls a loopIteration() method that only rotatesCameraY by a given amount, then redraws the screen. But the SkyBox doesn't rotate. It's the weirdest thing, but it should be a known issue (something that I'm doing wrong that's already been done). Right?

Support / Oculus VR SDK
« on: June 06, 2017, 05:45:14 pm »
Has anyone ever done an example using Android Studio and the Oculus VR SDK?

Bones / My Format
« on: May 25, 2017, 04:01:30 am »
Raft, I sent you and Egon a screenshot of my Max exporter. My format, which comes out of 3ds max fully JSON-serialized, comes with three types of animation: vertex animation for expressions, skin animation, and a third kind, which is vertex animations in place of skin animations. Now there's two reasons for the third kind: no need for a bone structure should I use the format in other platforms and, more urgently, because although I can import a model whose joints distort it intuitively, I have never been able to play a skin animation either in Bones or in Blender (or, for that matter, in a Java port of Animadead which I made). The only thing I'm exporting, having tried everything else, are the euler angles per joint per animation frame. I'm convinced that that's enough, but I can't get it to work. The weights all appear to be the same as they are in Max. I would like your help in fixing this (there's really no other reasonable way to export skinned models out of Max and into Bones anymore now that OgreMax is dead).

Support / How to import vertex animations
« on: May 09, 2017, 02:12:21 pm »
As you know, Egon, I'm writing that JSON-serialized file format. Right now, I'm working on the vertex animations. I've stored the frames in a file. The current version of the method looks like the following. But the trouble now is that the only idea I have is to clone the only Mesh instance I have and distort it with a vertex controller. But that doesn't really seem right to me.

Code: [Select]
     public static Object3D loadVertexAnimated(String fileName) {
        NoBonesImporter jImporter = new NoBonesImporter();
        ArrayList<ArrayList> objects = jImporter.getList(fileName);
ArrayList<NoBoneAnimation> importedAnimations = jImporter.getAnimations(fileName);
Object3D[] list = Object3D[objects.size()];
for (int i = 0; i < objects.size(); i++) {
     ArrayList<ArrayList> theObject = objects.get(i);
     ArrayList<ArrayList> importedVertices = theObject.get(0);
             ArrayList<ArrayList> importedUVs = theObject.get(1);
             ArrayList<ArrayList> importedFaces = theObject.get(2);
             float[] coordinates = makeCoordinates(importedVertices);
             float[] uvs = makeUVs(importedUVs);
             int[] indices = makeIndices(importedFaces);
     Object3D anObject = new Object3D(coordinates, uvs, indices,0);
     list[i] = anObject;


int numTriangles = importedVertices.size(), numFrames = importedAnimations.size();
for (i = 0; i < numFrames; i++) {
     int frame = i;
     Object3D anObject = list[i];
     Mesh aMesh = anObject.getMesh();
     NoBoneAnimation anAnimation = animations.get(i);
     String name =;
     int numFrames = anAnimation.frames.size();
     Animation animation = new Animation(numFrames);

     for (ArrayList<ArrayList> importedVertices: anAnimation.frames) {
// Create a new mesh with vertex controller?
SimpleVector[] vertices = SimpleVector[importedVertices.size()];
for (int j = 0; j < vertices.length; j++) {
      SimpleVector v = new SimpleVector(vert.get(0), vert.get(1), vert.get(2));
vertices[j] = v;
Object3D anObject = makeAnimated3D(pose, objectsBonesReferences.get(i), theObject);

Support / Rotation Towards 3D Point
« on: March 07, 2017, 09:10:49 pm »
The following isn't working. How come?

Code: [Select]
     public void rotateTowards(SimpleVector towards) {
SimpleVector directionVector = new SimpleVector(towards.x -model.getTransformedCenter().x, towards.y -model.getTransformedCenter().y, towards.z -model.getTransformedCenter().z).normalize();//WON'T WORK WITH OR WITHOUT NORMALIZE()
Matrix rotationMatrix = directionVector.getRotationMatrix();
if (this instanceof Worker)
else model.setRotationMatrix(rotationMatrix);

Support / PolygonManager.getTransformedVertex is Unreliable
« on: February 24, 2017, 05:02:18 pm »
The following is supposed to test if a character is over a particular square in a 2d array of planes (as created from the ExtendedPrimitives class). It doesn't work. The previous version of this method compared the centers of all planes and it worked (but looked terrible). I should note that I'm using the software renderer.

Code: [Select]
     public java.awt.Point boardSpaceFromWorld(SimpleVector ws) {
for (int y = 0; y < planes[0].length; y++) {
     for (int x = 0; x < planes.length; x++) {
Object3D plane = planes[x][y];
PolygonManager polyMan = plane.getPolygonManager();
SimpleVector[] vertices = new SimpleVector[6];
vertices[0] = polyMan.getTransformedVertex(0, 0);//, plane.getInverseWorldTransformation(), new SimpleVector());
vertices[1] = polyMan.getTransformedVertex(0, 1);//, plane.getInverseWorldTransformation(), new SimpleVector());
vertices[2] = polyMan.getTransformedVertex(0, 2);//, plane.getInverseWorldTransformation(), new SimpleVector());
vertices[3] = polyMan.getTransformedVertex(1, 0);//, plane.getInverseWorldTransformation(), new SimpleVector());
vertices[4] = polyMan.getTransformedVertex(1, 1);//, plane.getInverseWorldTransformation(), new SimpleVector());
vertices[5] = polyMan.getTransformedVertex(1, 2);//, plane.getInverseWorldTransformation(), new SimpleVector());
float minX = Float.MAX_VALUE, maxX = Float.MIN_VALUE, minZ = Float.MAX_VALUE, maxZ = Float.MIN_VALUE;
for (int i = 0; i < 6; i++) {
     if (minX > vertices[i].x)
minX = vertices[i].x;
     if (maxX < vertices[i].x)
maxX = vertices[i].x;
     if (minZ > vertices[i].z)
minZ = vertices[i].z;
     if (maxZ < vertices[i].z)
maxZ = vertices[i].z;
if (ws.x > minX && ws.x <= maxX && ws.z > minZ && ws.z <= maxZ)
     return new java.awt.Point(x, y);
return new java.awt.Point();

Bugs / Tiny Doc Correction
« on: February 10, 2017, 06:43:07 pm »
You know I'm neurotic with language, so here goes a tiny one: Object3D(int maxTriangles) should read, "...also create dummy objects, that are just "lending" THEIR..." ; )

Support / Painting a Mouse Cursor-Selected Polygon
« on: February 07, 2017, 06:52:55 am »
I'm trying to paint an area of my 3d plane as a cursor is moved (think area selection for building in a strategy game). The furthest (farthest?) I got was:
Code: [Select]
VisList visList = theWorld.getVisibilityList();
int polyID = Interact2D.getPolygonID(Interact2D.pickPolygon(visList, Interact2D.reproject2D3D(theCamera, buffer, x, y)));
I assume that camera-space is all I need here, since the docs suggest reproject2D3D and not reproject2D3DWS. Even if this is right, how can I now get something useful out of it (like, say, the vertices of the returned polygon)?

Support / LwJGL 3.1?
« on: January 08, 2017, 08:58:02 pm »
I'm concerned that the old lwjgl dlls might stop working soon (and certainly will at some point). I'm actually only downloading it right now. I haven't even had a look at it, but I gather it's something much fatter and redundant than the 2s. I don't even know if AWTGLCanvas was kept. Have you tested jpct with version 3.1?

Support / Special Vertices
« on: December 23, 2016, 01:40:26 pm »
I'm taking the opportunity, as I finish my JSON-serialized format, to make special vertices (I'm thinking of three types at the moment, "regular," "hair," and "cloth" from which I might hang a runtime-generated cape). Where do you recommend I store this information (what might I subclass? Object3D? PolygonManager? SimpleVector?).

Feedback / Feature Request: Cube-Mapping
« on: December 13, 2016, 09:49:25 am »
It would sure make life easier and more satisfying with shaders.

Also, a little love for the software renderer (simple things like Polylines to make its behavior identical to the hardware renderer).

Bones / Jaw Bone
« on: November 30, 2016, 06:21:26 am »
Is it possible that bones could ignore special bones, like jaws and eyes? I'm fairly sure that the jaw bone animation on my model is getting exported but, alas, the jaw isn't opening.

Bones / How to Fill SkinData
« on: June 16, 2016, 06:44:26 am »
I've exported into a JSON-serialized format of my creation all the weights of all the joints in each vertex. How, now, do I fill the 2-dimensional arrays that are weights and jointIndices? Thanks in advance.

Support / Texture Coordinates
« on: June 16, 2016, 06:38:44 am »
I'm creating my very own JSON-serialized 3d format, for use with Bones. It will come straight out of 3ds max via a MaxScript I'm developing (Python script for Blender to follow). In point of fact, it's almost ready, save for the fact that I don't yet understand how to create a SkinData object (question to be posted on the Bones board and I do already have a SkeletonPose object filled) and the little texture issue that I'm having. I'm creating the Object3D's (non-skinned objects will also be supported in my format) texture coordinates with the following line. And the result is visible in the image that follows (mostly correct save for minor issues). I suspect it's a rounding issue. What do you think, Egon?

Code: [Select]
anObject.addTriangle(vector1, uv1.get(0), -(uv1.get(1)-1f), vector2, uv2.get(0), -(uv2.get(1)-1f), vector3, uv3.get(0), -(uv3.get(1)-1f));

Pages: 1 [2] 3 4 ... 15