Changing direction of camera - can't get it to look where I want?

Hi. My program is based around the HelloCollision demo program (using physics & player objects).

I have a function that jumps the camera to a certain vector (which works fine), but cannot get the camera to look straight ahead at the ‘building’ you jump to?

Have tried player.setViewDirection and cam.lookAt - but neither one will look at a definitive point?

Regards, Alex,%20com.jme3.math.Vector3f)

Should look at a point. We can’t see your code so we don’t know what you might have done wrong, though.

[java] public void jumpToLocation(String location) {
cam.lookAt(buildings.getBuildingCoord(location), Vector3f.UNIT_Y);

This is the only relevant method. The buildings.getBuildingCoord(location) is the vector location of the front of the building. I just want to be able to look straight ahead every time, at the building. I have also tried replace (Vector3f.UNIT_Y) with 0,1,0 and other combinations, but it doesn’t change.

I’ve looked at all the documentation, and it should work, but it the direction never seems to change. I’ve also tried player.setViewDirection(buildings.getBuildingCoord(location)); and hard coding a vector at the back of the building to no avail.

I think that code should work. Something else must be unsetting it. Do you have a fly camera or something enabled? A camera node or something?

There is a fly cam present, but is not initialised anywhere. It was in the existing demo code, (to set move speed), but when you change the value nothing happens. I presumed it was irrelevant.

This was the foundation demo I used :

Fly cam is initialized by default unless you remove it or disable it. It shouldn’t be affecting this but maybe it is.

Either way, you should put together a simple test case of making a camera look at a specific location… if for nothing else than to prove to yourself that it can work. Sometimes that’s all it takes to spot the real issue.