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

Pages: 1 2 3 [4] 5
46
Support / Re: Mouse-drag camera rotation (UDK like)
« on: October 09, 2011, 02:39:26 pm »
Thank you Egon,

I implemented the code you wrote in this way:

Code: [Select]
public void rotateView(int dx, int dy){
       
        if (dx !=0 || dy != 0){
        SimpleVector line =new SimpleVector(dx, 0, dy);
            Matrix m = line.normalize().getRotationMatrix();
           
            m.rotateAxis(m.getXAxis(), (float) -Math.PI/2f);
            camera.rotateAxis(m.invert3x3().getXAxis(), line.length() / 500f);
        }

}

However it works in the same way as the simpler code above. So if there is a cube in the scene it works fine if you point at the cube and drag, but if you point away and drag the camera jerks back to point at the cube....

If you think of Google Maps for instance? When you use the street view? And you are able to point anywhere in the screen and dragging the mouse gradually moves the camera/shifts the focus to reflect the mouse movement?

I am thinking that maybe you need to return the current rotation of the camera and add/sub struct from it instead of rotating the camera from scratch at each mouse drag.... But I couldnt find a method on Camera to return the rotation, only the axes?

Anyhow, thanks for your prompt help!

47
Support / Mouse-drag camera rotation (UDK like)
« on: October 09, 2011, 01:46:06 pm »
Hello all,

I am working on building a simple JPCT map editor, I am trying to implement the same navigation style as Unreal Development Kit (or Blender, 3DSMax, Unity etc...).

Basically in these kits holding a mouse button and dragging makes the camera rotate in a cumulative way, so that for example you rotate 20 degrees on the X axis by moving the mouse up. The next time you drag the mouse, the rotation starts from the same point where it was left....

Currently I have a mouse listener that returns the delta x and delta y whenever the mouse is moved. In my World I am using the same camera code on the Wiki:
Code: [Select]
       public void rotateView(int dx, int dy){
Matrix rot = world.getCamera().getBack();


if (dx!=0) {
camera.rotateAxis(camera.getYAxis(), dx / 500f);
}

if (dy!=0) {
rot.rotateX(dy / 500f);
}
}

Which work great I think for a continuous movement like in a FPS game, but currently whenever I click the mouse and drag the rotation starts from the center each time, so basically it jerks back into place at each mouse movement...

Can anyone give me a hint as to how i can implement this?
 
Thanks a lot!

48
Support / Collision Information. Who collided with what
« on: October 01, 2011, 09:35:32 pm »
Hi Egon,

I've been looking through the forum and the Wiki for this, apologies if it's already been asked. Basically the checkXXXcolision method is very helpful for modifying the direction of the object in case a collision occurs, but is there a way to get information as to what object I have just collided with? So that for e.g. some action could be performed on such object?

Thank you very much!

49
Bones / Re: General advice on model/skeleton structure for Bones
« on: September 24, 2011, 02:15:59 pm »
Hi Raft!

Back again... Wanted to ask your advice on the performance of my app so far... on my ZTE Racer (Android v2.1) I get about 20 fps with up to three animated ninjas on screen... With my own app I am stuck between 5 and 10 fps with only my model up. I used the Optimizer modifier in 3DS Max to get my mesh down to around 1100 polygons, so it's not much more than the Ninja....

I was wondering if there's anything else that can contribute to speed up to processing a bit, if it's in the number of bones in the skeleton or particular engine operations to try and cut down on....

Thank you for your support!

50
Bones / Re: Model badly deformed when imported
« on: September 20, 2011, 07:07:56 pm »
well I'm actually using the Ninja demo, i have just replaced the ninja model with my own and have tweaked a few things... while with the Ninja model all animations loop with my one they just stop, that's why I thought it was a setting of the model? Mmm.. I'll try play with it a bit more....

51
Bones / Re: Model badly deformed when imported
« on: September 20, 2011, 06:55:00 pm »
those script files provides help if no argument is given. anyway here is an example:

Code: [Select]
jmeOgre2Bones -scale 2 -rotation x180 -out mine.bones -in mine.ogre.xml

Brilliant. I just couldn't find this setup anywhere in the docs... Thanks immensely, you're a really patient and devoted man ;)

One last thing and then I'll let you go (for today at least lol)... Did you set up the Ninja's animations in a specific way for them to loop continuously like they do in the Ninja's demo? Cos my one just stops after playing once...


52
Bones / Re: Model badly deformed when imported
« on: September 20, 2011, 06:33:18 pm »
You should scale or rotate the model while converting from Ogre format to Bones format. Both script files and JMEOgreImporter class has support for that

Ok I can see that the main method of JMEOgreImporter also takes a scale and rotation method, but how do you feed those exactly from the command line? I'm guessing they'll be right after the -out and -in values... I tried "-rotation" and "-scale" followed by some values but no luck?

53
Bones / Re: Model badly deformed when imported
« on: September 20, 2011, 05:09:50 pm »
Yes, there is OgreMax. I really recommend it.

Right, installed OgreMax and re rigged the character using a Max biped. No more deformations, the model animates ok, so thanks for the tip!

However the imported model is extremely tiny and upside down. I can rotate it and scale it upon loading it but when it animates it goes back to its tiny size and to being upside down. I'm guessing that rescaling at each frame is not a good idea.... should I enlarge and capsize the model or is there a better solution? Maybe there is some export option in OgreMax that shrinks it...

Thanks for your help.

54
Bones / Re: Model badly deformed when imported
« on: September 20, 2011, 01:02:26 pm »


On the left is the animated mesh in Blender and on the right the mesh in the emulator, lying flat and with deformed hands/arms....

Is there a plugin for 3DSMax to export a mesh as an ogre file? I could try to see if I get the same issue exporting from Max....

Thanks for your help!

55
Bones / Re: Model badly deformed when imported
« on: September 20, 2011, 10:40:25 am »
UPDATE:

Ok so I resolved the out of memory issue, it turns out the the model mesh was double sided, disabling that got rid of the memory problem. Also I cleared all translations and rotations of the model before exporting it

The model appears now a bit less deformed, especially when I disable the "Fix Up Axis To Y" option in the OGRE exporter, but then it faces the Y axis when animated (lies flat on floor)....

Also the Bones exporter keeps flashing a "rotation axis not normalized" warning before successfully exporting it.... Maybe that has got something to do with it?

This is the complete log from the export:

Code: [Select]
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
-- total 25 joint(s) --
0 name: foot_L, parent:
1 name: spine.base, parent:
2 name: foot_R, parent:
3 name: toe_L, parent:
4 name: toe_R, parent:
5 name: ankle_R, parent: 2:foot_R
6 name: spine.top, parent: 1:spine.base
7 name: leg.upper_L, parent: 1:spine.base
8 name: ankle_L, parent: 0:foot_L
9 name: leg.upper_R, parent: 1:spine.base
10 name: shoulder_R, parent: 6:spine.top
11 name: shoulder_L, parent: 6:spine.top
12 name: neck, parent: 6:spine.top
13 name: leg.lower_L, parent: 7:leg.upper_L
14 name: leg.lower_R, parent: 9:leg.upper_R
15 name: arm.upper_L, parent: 11:shoulder_L
16 name: arm.upper_R, parent: 10:shoulder_R
17 name: head, parent: 12:neck
18 name: head.002, parent: 12:neck
19 name: arm.lower_L, parent: 15:arm.upper_L
20 name: arm.lower_R, parent: 16:arm.upper_R
21 name: hand_R, parent: 20:arm.lower_R
22 name: hand_L, parent: 19:arm.lower_L
23 name: fingers_L, parent: 22:hand_L
24 name: fingers_R, parent: 21:hand_R
-- --
Skeleton created out of jME OGRE skeleton, 25 joints
Created skeleton animation clip: Walk
Loaded ogre file: girlnpc.mesh.xml, scale: 1, rotation: null
        1 sub objects, 1 skin animation(s), 0 pose animation(s)
Saved bones-group to ninja.group.bones

56
Bones / Re: Model badly deformed when imported
« on: September 20, 2011, 10:05:11 am »
It looks fine. It's only when animated that it goes mayhem. Also I can't manage to launch it from the emulator, I get a OutOfMemory run time exception... The model isn't really that complex, it's only got 1600 vertices with a 512x512 JPEG texture, and there's only a cube in the scene for now...

The app does launch from my phone but it goes very slow, with the model getting distorted when animated...

Thanks for your time Raft

57
Bones / Model badly deformed when imported
« on: September 19, 2011, 10:47:42 pm »
Hi Raft

Do you have any hints for a model that appears completely deformed when imported? Basically the hands and the feet get stretched far away from the body and all the body stretches in weird ways when it moves.

The export seems to have been successful, this is the log:

-- --
Skeleton created out of jME OGRE skeleton, 25 joints
Created skeleton animation clip: Walk
Loaded ogre file: girlnpc.mesh.xml, scale: 1, rotation: null
        1 sub objects, 1 skin animation(s), 0 pose animation(s)
Saved bones-group to ninja.group.bones

The model behaves ok in Bender, all vertices have been assigned weights....

Thank you for your time!

58
Support / Re: Worldspace units. Workflow for placing objects in world?
« on: September 18, 2011, 10:21:24 pm »
Cool. I made a test in the end with a mesh consisting of a floor and four walls. I was impressed to see that the collision checks actually work with each individual wall, I was afraid that the engine would only create a big bounding box enclosing the entire mesh but that doesn't seem to be the case.

Thanks for your help!

59
Bones / Re: General advice on model/skeleton structure for Bones
« on: September 18, 2011, 06:10:51 pm »
Brilliant. That did it. Only that in the Ninja demo ninjas.get(0) returns an AnimatedGroup. For the Animated3D object I had to do:

Code: [Select]
ninjas.get(0).get(0).setCollisionMode(Object3D.COLLISION_CHECK_SELF);
directionVector = ninjas.get(0).get(0).checkForCollisionEllipsoid(directionVector, ellipsoid, 1);

Thanks for your prompt help!

60
Support / Re: Object3D.checkForCollisionEllipsoid(Unknown Source)
« on: September 18, 2011, 05:42:46 pm »
I'm actually having the same problem though the object has been added to the world. I'm trying to add collision detection to the Ninja from the Bones demo, this function is called in the initialization bit:

Code: [Select]
private void addNinja() {

AnimatedGroup ninja = masterNinja.clone(AnimatedGroup.MESH_DONT_REUSE);

ninja.getRoot().translate(0,0,-20);
ninja.getRoot().setCollisionMode(Object3D.COLLISION_CHECK_SELF);

ninja.addToWorld(world);

ninjas.add(ninja);
}
And upon pressing a button I try to check for collisions before applying the translations
Code: [Select]
directionVector = new SimpleVector(0,0,2);

.....

directionVector = ninjas.get(0).getRoot().checkForCollisionEllipsoid(directionVector, ellipsoid, 2);
ninjas.get(0).getRoot().translate(directionVector);

But I keep getting a Null error for the checkForCollision line?

EDIT:

Raft just helped me out with this. For an AnimatedGroup the set and check need to be done on the Animated3D object, not on the Object3D. In the Ninja demo ninjas.get(0) returns the animated group, ninjas.get(0).get(0) returns the Animated3D object:

Code: [Select]
ninjas.get(0).get(0).setCollisionMode(Object3D.COLLISION_CHECK_SELF);
directionVector = ninjas.get(0).get(0).checkForCollisionEllipsoid(directionVector, ellipsoid, 1);

Pages: 1 2 3 [4] 5