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

Pages: [1]
1
Support / Object3D.checkForCollisionEllipsoid(Unknown Source)
« on: September 11, 2011, 03:56:46 pm »
Hello!
I splitted um my Code which created a simple Scene and a moveable character.
Before i splitted it up to more classes (like player, or scene...) the collision worked fine.
But now I get  the exception you see in the title :

Object3D.checkForCollisionEllipsoid(Unknown Source)

The whole exception says:

Exception in thread "main" java.lang.NullPointerException
   at com.threed.jpct.Object3D.checkForCollisionEllipsoid(Unknown Source)
   at WWWGame.Game.loop(Game.java:131)
   at WWWGame.Game.start(Game.java:81)
   at Start.init(Start.java:30)
   at Start.main(Start.java:16)


So there must be a variable in line 131 which is null... but there isn't.

Thats the line:

moveRes = szene.getPlayer().getObject().checkForCollisionEllipsoid(moveRes,
            ellipsoid, 8);

All variabled are defined and not null.
Any idea what the problem is?

2
German corner / Object3D MOVEIN?
« on: August 19, 2011, 07:42:56 pm »
Hallo!
Hab' gerade den GermanCorner entdeckt :-)
Ich hoffe es stört niemanden, dass ich in so kurzer Zeit so viele Fragen habe...
Ich frage mich jetzt z.B. gerade, wie ich es schaffen kann, ein Object3D wie die Camera einfach in Blickrichtung zu bewegen.
Ich habe mir schon eine "fliegende" Kamera erstellt, die man mit den W,A,S,D - Tasten durch die Welt steuert und mit der Maus die Richtung bestimmt..
Dazu gibt es ja netterweise
Code: [Select]
moveCamera(Camera.CAMERA_MOVEIN, 1);
Das gibt es beim Object3D nicht, dass kann ich nur bewegen, indem ich es an der X (Y,Z) - Achse versetze...
Wenn man nun aber W drückt um nach vorne zu gelangen, hängt das ja von der Blickrichtung der Kamera ab...
Ich habe wirklich schon viel herumprobiert und nach den richtigen Methoden gesucht, es ist aber noch nichts brauchbares dabei herausgekommen...
Ich habe es vor recht langer Zeit mal mit der JMonkeyEngine geschafft, ist aber schon recht lange her...
Weiß jemand Rat?

3
Support / Collision problem
« on: August 17, 2011, 12:46:06 am »
Hello again :)
Since the last problem was solved (thanks for that again) I got a new one.
I'm still working with a scene which has a terrain and a figure.
I'm trying out the Collision samples and have one problem:
When I say
Code: [Select]

private SimpleVector moveRes = new SimpleVector(0, 0, 0);
private SimpleVector ellipsoid = new SimpleVector(2, 2, 2);
private static final float DAMPING = 0.1f;
moveRes=character.checkForCollisionEllipsoid(moveRes, ellipsoid, 8);
character.translate(moveRes);
SimpleVector t = new SimpleVector(0, 1, 0);
t = character.checkForCollisionEllipsoid(t, ellipsoid, 1);
character.translate(t);
if (moveRes.length() > DAMPING) {
moveRes.makeEqualLength(new SimpleVector(0, 0, DAMPING));
} else {
moveRes = new SimpleVector(0, 0, 0);
}
and
Code: [Select]

character.setCollisionMode(Object3D.COLLISION_CHECK_SELF);
terrain.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
it works not PERFECT.
The figure just falls half into the terrain.
Sorry, i can't explain it better in english, here a screenshot: http://imageshack.us/f/832/scr01o.png/
When  i don't use collisionModes, the figure just stands on top of the ground, whith collision it falls into the terrain...

4
Support / 3Ds loading Bug???
« on: August 14, 2011, 02:07:40 pm »
Hello!
I'm an absolutly beginner in jPCT and have a problem:
I'm trying to load a 3D Model which is exportet to .3ds from Blender.
So i load that model with a method from a tutorial:
Code: [Select]
private Object3D loadModel(String filename, float scale) {
Object3D[] model = Loader.load3DS(filename, scale);
Object3D o3d = new Object3D(0);
Object3D temp = null;
for (int i = 0; i < model.length; i++) {
temp = model[i];
temp.setCenter(SimpleVector.ORIGIN);
temp.rotateX((float) (-.5 * Math.PI));
temp.rotateMesh();
temp.setRotationMatrix(new Matrix());
o3d = Object3D.mergeObjects(o3d, temp);
o3d.build();
}
return o3d;
}
I downloaded the model there: http://e2-productions.com/repository/modules/PDdownloads/singlefile.php?cid=2&lid=161
But some parts of the model dissapear, depending on the camera-position.
An arm, the head or the whole body...
I never see the complete Figure, only peaces of it...

Any ideas?

Edit:
I see now, the figure just dissapears like every other Model, when the camera moves too far away.
But this model begins earlier to dissapear than the others do.

Pages: [1]