Recent Posts

Pages: [1] 2 3 ... 10
1
Support / Re: Camera rotation issue
« Last post by EgonOlsen on July 17, 2018, 03:09:38 pm »
Quote
The camera's rotation is never reset so I think the issue might lie here...
Yes, most likely. You can try to apply http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Matrix.html#orthonormalize() from time to time to it and see if that helps.
2
Support / Re: Camera rotation issue
« Last post by AeroShark333 on July 17, 2018, 02:50:48 pm »
So I have a spherical object (which position changes every draw call).
For that, I need to move the camera along with the object which is step 1 (settings the camera's position to the center of the sphere)
But the user might have some touch interaction going on (which changes the camera rotation)
Also autorotation could be enabled (which also changes camera rotation)
I basically change the rotation of the camera while the camera is in the center of the spherical object.
And only after that I apply step 3 (Camera.MOVE_OUT), this makes sure that the camera faces the center of the spherical object.
But it's not like I'm using Camera.MOVE_OUT with diffferent radia, it's fixed.

EDIT: I just noticed that I swapped step 1 and step 2 in my code... but that still shouldn't matter I believe

Only when autorotation is enabled it will start to get messy after a while. (the spherical object is no longer perfectly in the center)
When you try to change the rotation with touch(or autorotation), it will look like the spherical object is also rotating around some (really small) pivot point (which isn't really there since it should just be the object's center)
But at launch (when autorotation hasn't been active for long) the rotation using touch (or autorotation) works fine and there's no weird offsets or extra 'pivot point'.

The spherical object does actually rotate around some pivot, but this position is reset every draw call (so I don't think it's related to this).
The camera's rotation is never reset so I think the issue might lie here... (long-term rotations causing accuracy issues)

_______________________
SIMPLIFIED CODE FOR DRAW CALLS:
_______________________
object.clearRotation();
object.clearTranslation();
object.translate(blahblah1);
object.rotate(blahblah2); // I personally don't think the issue is here since the rotations aren't accumulated but reset for every draw call

camera.rotateX(touchX+autorotationX);
camera.rotateX(touchY+autorotationY);
camera.rotateZ(dualTouchZ+autorotationZ);

camera.setPosition(object.getTransformedCenter());

camera.moveCamera(Camera.CAMERA_MOVEOUT, someRadius);
3
Support / Re: Camera rotation issue
« Last post by EgonOlsen on July 16, 2018, 11:19:02 am »
Yes, shoulds like some accuracy issue, but some your description, it's hard to tell where it comes from!? What does step 2/apply rotations actually do?
4
Support / Re: How to get the normal vector by touching the screen?
« Last post by EgonOlsen on July 16, 2018, 11:17:39 am »
You can attach a CollisionListener to the object (http://www.jpct.net/doc/com/threed/jpct/CollisionListener.html), make it return true in its requiresPolygonIDs() implementation and use the data returned by the collision event in combination with the http://www.jpct.net/doc/com/threed/jpct/PolygonManager.html. That should give you the desired data.
5
Support / Re: Billboarding Y-Axis fixed Sprite
« Last post by EgonOlsen on July 16, 2018, 11:12:39 am »
so, when I choose setBillboarding(true) will the jpct engine update on each frame the matrix according to the camera facing vector?
Yes, it updates it every frame. And so should you.
6
Support / How to get the normal vector by touching the screen?
« Last post by Zhangzqs on July 16, 2018, 08:56:36 am »
I clicked on the screen and calcMinDistanceAndObject3D can determine which 3d object I clicked on, but how do I determine the polygon data I clicked? How to find the coordinates and normal vectors of the clicked polygon.
7
Support / Camera rotation issue
« Last post by AeroShark333 on July 14, 2018, 01:34:13 pm »
Hello,

I got a small issue with camera rotations.
My camera automatically rotates around a spherical object like this:
1. Set camera position to center of sphere.
2. Apply rotations
3. Camera.MOVE_OUT
This all works fine but after a long while (let's say 8+ hours) the rotation around the sphere don't seem spherical any more (or the rotation pivot center has some offset).
But the spherical object that the camera is facing isn't in the center any more but slightly offset. The longer you wait the worse this offset gets.
I suppose it'd have to do something with floating point precision but I'm not sure.
Any solutions?

Cheers
9
Support / Re: Billboarding Y-Axis fixed Sprite
« Last post by Jamiro on July 11, 2018, 03:36:20 pm »
Ok, so I just need to ask 1 simples question, do I need to update the billboarding matrix on each draw step? Or is the matrix itself capable of using camera space and need only to be changed once?

so, when I choose setBillboarding(true) will the jpct engine update on each frame the matrix according to the camera facing vector?

many thanks
10
Bones / Re: getBindPose() is Late
« Last post by AGP 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
Pages: [1] 2 3 ... 10