So I went on IRC… and apparently it’s a ghost city
Hello, I’m new, gonna very likely become a very active part of the userbase of jme! It’s really good! (first engine I’ve ever used, am a 1st year @ IT)
Gonna post the log of IRC, too lazy to retype everything
SIMPLIFIED QUESTION (I’m such a retard):
cam.lookAtDirection(new Vector3f(0, -1, 0), Vector3f.UNIT_Y);
//cam.lookAt(new Vector3f(0, -1, 0), Vector3f.UNIT_Y);
Why does either of THESE if used INVERTS the f******* axis!? left becomes right, up becomes down, etc! I want a top-down view! Godammit.
The forums are very active. No idea about IRC as I don’t use it
Hehe ok
BTW, anyone not noticing, my problem is described in the IRC Log! Dam laziness.
Never tried a top down camera myself, closest I come is (0,30,1) looking at (0,0,0). What do you have as the “up” direction for the camera?
(0,1,0)
@tiagoparreira said:
(0,1,0)
Well, just looking at it conceptually a camera pointing straight down with an "up" of 0,1,0 doesn't sound very healthy...I'm not sure how that works out in practice though...
My logic was, it’s looking from 0,1,0 down to 0,-1,0, which means looking down y axis. Which WORKS, but it inverts the z and x.
But yeah, I had already seen that presentation, and I have a pretty good grasp of most of these mechnics but I can’t quite put my finger on LookAt, could you explain a little better perhaps @wezrule? Or anyone else?
Thanks!
cam.lookAt(new Vector3f(0, -1, 0), Vector3f.UNIT_Y);
This alone will look down Y axis, but inverts X and Z.
If I add a simple rotation, I can’t ever see anything:
Quaternion rotation = new Quaternion();
rotation.fromAngleAxis(-FastMath.PI, Vector3f.UNIT_Y);
cam.setRotation(rotation);
@tiagoparreira said:
cam.lookAt(new Vector3f(0, -1, 0), Vector3f.UNIT_Y);
This alone will look down Y axis, but inverts X and Z.
If I add a simple rotation, I can't ever see anything:
Quaternion rotation = new Quaternion();
rotation.fromAngleAxis(-FastMath.PI, Vector3f.UNIT_Y);
cam.setRotation(rotation);
You understand that this last one is looking 180 degrees left and not looking down, right? The angle sets the rotation and the axis sets the axis about which you rotate.
I think you want UNIT_X and you only want to rotate 90 degress... so HALF_PI.
Yes, that’s the purpose, it’s a sort of attempt to “fix” the looking down Y axis causing it to invert X and Z… I’ll try that regardless (didn’t understand the why of that)
Thanks
Try putting the up vector as UNIT_Z.
(I’ve no idea what that will do, it’s just something to try)
Substituting the up with Z or X doesn’t get me correct directions, had already tried.
(To add: I’m going UP(-Z), DOWN(+Z), RIGHT(+X), LEFT(-X), with my WASD keys. I want to face the XZ plane.)
I honestly am fed up with this, almost all day thinking and experimenting with this ocasionally and I CANNOT reach a solution… by LOGIC and I’m pretty certain that’s correct, Is should just rotate over the Y axis 180º, PI, and the directions would all be ok. But jesus, I must be a tool for not being able to use the engine right…
What did you get when you did:
[java]
Quaternion rotation = new Quaternion();
rotation.fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X);
cam.setRotation(rotation);
[/java]
???
That is exactly what you want to be doing, to me. The “look at” function is for convenience but it’s going to go all wiggy when you try looking directly down your own up vector.
Yeah, I verified the directions and like I had written in topic before, the direction actually goes: (0, something infinitely approximate to -1, something infinitely approximate to 0)
Nothing rendered to screen when I do what you said. I have a big box @ origin, (0,0,0).
What you told me makes the camera go… somewhere, and won’t render anything.
It dosnt change the position of the camera at all. The rotation gets changed.
Try to move around and look wether a box is there. It has to. ( Draw a grid per x,y , y, z and x,z plane in different colors if you have problems navigating in 3D space. )
Can I ask why you are trying to get this vertical camera? It’s actually quite unusual in games to have a perfectly top-down view (which may be why people have never attempted it) and you can probably save a world of pain by not doing it yourself and get results which may well actually look better (the reason most games don’t do it).
It’s similar to the same reason most games aren’t set at noon. Noon gives boring shadows, vertically down gives boring views.
lol, look what I managed to get drawn onto a texture (bug, right?) without doing anything
http://imgur.com/FJmIk
I’m feeling like a complete retard, probably don’t dominate the concepts as well as I thought >.>
Box b = new Box(Vector3f.ZERO, 5000, 1, 5000); // create cube shape at the origin
Geometry geom = new Geometry(“Box”, b); // create cube geometry from the shape
Material mat2 = new Material(assetManager,
“Common/MatDefs/Misc/Unshaded.j3md”); // create a simple material
mat2.setColor(“Color”, ColorRGBA.Blue); // set color of material to blue
geom.setMaterial(mat2); // make the cube appear in the scene
Box b2 = new Box(Vector3f.ZERO, 1, 5000, 5000); // create cube shape at the origin
Geometry geom2 = new Geometry(“Box”, b2); // create cube geometry from the shape
Material mat3 = new Material(assetManager,
“Common/MatDefs/Misc/Unshaded.j3md”); // create a simple material
mat3.setColor(“Color”, ColorRGBA.Red); // set color of material to blue
geom2.setMaterial(mat3); // set the cube’s material
rootNode.attachChild(geom2); // make the cube appear in the scene
Box b3 = new Box(Vector3f.ZERO, 5000, 5000, 1); // create cube shape at the origin
Geometry geom3 = new Geometry(“Box”, b2); // create cube geometry from the shape
Material mat4 = new Material(assetManager,
“Common/MatDefs/Misc/Unshaded.j3md”); // create a simple material
mat4.setColor(“Color”, ColorRGBA.Green); // set color of material to blue
geom3.setMaterial(mat4); // set the cube’s material
rootNode.attachChild(geom3); // make the cube appear in the scene
Can’t get the last box, the x.y plane, to show up… don’t know why…
And yes, I can see that it’s still there (of course), but I don’t understand what change the cam underwent… it kind of goes beneath it (@KuroSei)
Making a 2d/2.5d isometric game, @zarch. For simplicity of coordinates I’d simple have the camera follow the x and z, and it’d zoom out and in on the y. Would only have to place things @ the x and z coords, y would always be 0.
I had a reason for feeling retarded, switched the b2 with b3 on last one…