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

Pages: [1] 2 3 ... 108
1
Support / Re: Mouse-Walking on a Simple Plane
« on: October 23, 2018, 07:14:50 pm »
Should the above code work? Am I forgetting anything?

2
Support / Mouse-Walking on a Simple Plane
« on: October 23, 2018, 06:59:02 am »
I've made three dozen attempts. I have had success on a plane with multiple polygons, but I'd like to make it work on a large plane with only two triangles. My best (unsuccesful) attempt:

Code: [Select]
     public void mouseClicked(MouseEvent e) {
        moveByMouse(e.getX(), e.getY());
     }
     private void moveByMouse(int mouseX, int mouseY) {//WALKBYMOUSE; CALLED ONCE TO SETUP THE WALK DIRECTION
SimpleVector ray = Interact2D.reproject2D3DWS(camera, buffer, mouseX, mouseY);
if (ray != null) {
     SimpleVector norm = ray.normalize();

     float f = theWorld.calcMinDistance(camera.getPosition(), norm, 1000);
     if (1==1/*f != Object3D.COLLISION_NONE*/) {
SimpleVector offset = new SimpleVector(norm);
norm.scalarMul(f);
norm = norm.calcSub(offset);
origin = hero.getRoot().getTransformedCenter();
SimpleVector destination = new SimpleVector(norm);
destination.x += camera.getPosition().x;
destination.z += camera.getPosition().z;
destination.y = origin.y; // Make y the same as for the hero to avoid moving up/down.
hero.getRoot().setRotationMatrix(destination.calcSub(origin).getRotationMatrix());
this.destination = new SimpleVector(destination);
     }
}
go = true;
     }

3
Support / Re: Orthographic Camera
« on: September 27, 2018, 07:27:14 am »
I expect either FrameBuffer or World is responsible for doing these things, but which is it?

4
Support / Orthographic Camera
« on: September 26, 2018, 05:35:15 am »
Is it at all possible to extend the Camera instance to create an orthographic camera?

5
Support / Re: Float Positioning Blit Images
« on: September 07, 2018, 08:05:44 pm »
Quote
That's a whole different beast. Would it be sufficient to have them without depth buffering?

Is that like that one I did by extending Polylines? If so, no. ; )

I still haven't solved that displacement issue with AWTGLCanvas, by the way. I don't mean to be pushy but I dream of a day when you update the lwjgl version.

6
Support / Re: Float Positioning Blit Images
« on: September 04, 2018, 11:45:20 pm »
And software-rendered Polylines, please?

8
Bones / Re: getBindPose() is Late
« on: July 10, 2018, 11:44:19 pm »
Yet another attempt. This is based off of SkeletonDebugger. It's still not quite right:

Code: [Select]
     private void updateWeaponPos() {
SimpleVector o = weapon.getTransformedCenter();
SimpleVector d = getJointPosition(rightHand);
SimpleVector left = model.get(0).getXAxis();
weapon.translate(d.x-o.x, d.y-o.y+.1f, d.z-o.z);//d.x-o.x, d.y-o.y+.125f, d.z-o.z

//NOW ROTATION:
Skeleton skeleton = model.get(0).getSkeleton();

final int parentIndex = skeleton.getJoint(rightHandIndex).getParentIndex();
if (parentIndex != Joint.NO_PARENT) {
     Object3D bone = weapon;
     updateWeapon(bone, skeletonPose.getGlobal(parentIndex), skeletonPose.getGlobal(rightHandIndex));
}
     }
     private void updateWeapon(Object3D weapon, final Matrix start, final Matrix end) {
SimpleVector from = start.getTranslation();
SimpleVector to = end.getTranslation();
SimpleVector direction = to.calcSub(from);

weapon.getRotationMatrix().setTo(direction.getRotationMatrix());
weapon.rotateY((float)Math.PI+rotY);//rotY IS SO THAT THE WEAPON ROTATES ALONG WITH model.getRoot()
weapon.rotateAxis(weapon.getZAxis(), (float)Math.PI*.2f);
     }

Notes:
-Adding the weapon to the root of the character breaks the whole thing.
-I'm having to rotate the weapon by the same amount as the root because it otherwise doesn't chase the hand.
-It kind of looks right until you look straight at the hand and you see that the weapon is not facing the right direction during any given animation

9
Bones / Re: getBindPose() is Late
« on: July 08, 2018, 11:39:19 pm »
My next best attempt was this (but it doesn't look quite right):

Code: [Select]
weapon.getRotationMatrix().interpolate(weapon.getRotationMatrix(), skeletonPose.getLocal(rightHandIndex), 1f);
weapon.getRotationMatrix().matMul(model.get(0).getWorldTransformation());

10
Bones / getBindPose() is Late
« on: July 07, 2018, 08:32:52 pm »
Can I forcefully update it in order to have an item keep up with my character's hand?

11
Support / Re: Asymmetrical Scaling
« on: July 05, 2018, 08:50:40 pm »
That works, thank you. But it begs the question: why would an Extended Primitives cylinder object space not be at the origin?

12
Support / Re: Asymmetrical Scaling
« on: July 04, 2018, 03:06:45 am »
On the other hand, this time it may well be a Java bug:
Quote
Why does array[idx++]+=a increase idx once in Java 8 but twice in Java 9 and 10?
https://blog.takipi.com/stack-overflow-answers-the-top-java-questions-we-didnt-know-we-had/

13
Support / Re: Asymmetrical Scaling
« on: July 04, 2018, 02:56:55 am »
This still displaces it, but in a different direction:

Code: [Select]
     public void thicken(final float deltaTime) {
SimpleVector[] vertices = this.getSourceMesh();
SimpleVector[] destination = this.getDestinationMesh();
final SimpleVector c = new SimpleVector(obj.getTransformedCenter());
for (int i = 0; i < vertices.length; i++) {
     SimpleVector v = new SimpleVector(vertices[i]);
     v.x -= c.x;
     v.y -= c.y;
     v.z -= c.z;
     v.x *= (1f+deltaTime);
     v.z *= (1f+deltaTime);
     v.x += c.x;
     v.y += c.y;
     v.z += c.z;
     destination[i] = v;
}
this.updateMesh();
     }

14
Support / Re: Asymmetrical Scaling
« on: July 03, 2018, 01:50:16 am »
It works both ways, but it's getting displaced as it gets wider. Read that last version of thicken() and you'll see my many attempts to keep the center in the same place.

15
Support / Re: Asymmetrical Scaling
« on: July 01, 2018, 01:41:03 am »
Because I'm altering its vertices with the VertexController.

Pages: [1] 2 3 ... 108