Camera gets black

Hey I have tried to change the camera position and direction, but everytime I do so, I get a black screen until I move the mouse.

Does any of you have any idea, about what I should do to prevent this :slight_smile: ?

The code I have written to change the camera is:

[java] getCamera().setLocation(new Vector3f(0,-0.25f,-18));
cam.setRotation(new Quaternion(0, 0, -90, 0));

    flyCam.setMoveSpeed(0.0f);
    flyCam.setRotationSpeed(.0f);                    [/java]

I had an issue like that, but it was caused (somehow, it’s about 6 months ago) by a model that was loaded.
Maybe it’s because one of you 3d objects?
If you rotate your camera with the mouse to a similar direction (at the same location), does it still happen?

I don’t load any 3d objects… Or any other kind of things in this game, so I can’t see why that should be the problem.

When I use the flyCam in a “normal” way everything works fine… But the thing is, that I want my camera to have a fixed position and rotation, until I change it based on some events :slight_smile:

If you say, the problem disappeared, could it help to update the SDK ?

I have updated my SDK, without any changes I do sadly still have the same problems

If that’s the case, I have no idea, sorry, can only guess…
Maybe there IS just nothing to see in that direction, except for the viewport color? (still, only guessing…)

Only based on this information:

@nightmare2real said: [java] getCamera().setLocation(new Vector3f(0,-0.25f,-18)); cam.setRotation(new Quaternion(0, 0, -90, 0));
    flyCam.setMoveSpeed(0.0f);
    flyCam.setRotationSpeed(.0f);                    [/java]</blockquote>

I can’t see anything that would cause an issue (except for the cam being upside down, but that’s what you wanted to achieve), sry.

I don’t know if this would cause a problem, but this definitely looks weird:
[java]new Quaternion(0, 0, -90, 0)[/java]

Perhaps you wanted?
[java]new Quaternion().fromAngleNormalAxis(-FastMath.HALF_PI, Vector3f.UNIT_Z);
[/java]

1 Like

wezrule is right… quaternions are not what you think they are. You gave the camera a totally invalid quaternion so it ends up in some weird twisted 12 dimensional space or something where light tastes sweet and music is prickly on the skin.

When you move the mouse the fly cam corrects it to a valid quaternion.

1 Like

Okay, now it works to start with… But not when I change the camera position… I suspect this is because, I’m doing something wrong at the moment, but now I have something to be working on, thanks :slight_smile:

wezrule, it looked like you where correct ^^