BetterCharacterControl View Direction Changes No Effect on Camera or Model

Hi there,

I’m trying to get my model who has a BetterCharacterControl to face a certain spatial in the scene.

Unfortunately everything I have tried has no effect on the actual way the camera is facing.

Vector3f pointA        = player.getWorldTranslation();
Vector3f pointB        = ((Node)gm.getSceneManager().getScene().getChild
                                   ("Entity   Node")).getChild("Torch").getWorldTranslation();
Vector3f viewDirection = (pointB.subtract(pointA));
player.getPhys().setViewDirection(viewDirection);
System.out.println(player.getPhys().getViewDirection());

Running this code on a loop while moving around the room does change the rotation of the Physics Control but has no effect on the camera.

Here is a small snippet of the output. Hypothetically this should force the camera to remain focused on the “Torch”
but has no effect.

(-6.4092374, 0.47387758, 2.0293849)
(-6.3187323, 0.47386888, 2.1332579)
(-6.228227, 0.47386274, 2.2371304)
(-6.137723, 0.4738532, 2.341002)
(-6.0472174, 0.47384822, 2.444875)
(-5.9567127, 0.47384366, 2.5487473)
(-5.866208, 0.47383896, 2.6526196)
(-5.775704, 0.47383377, 2.7564917) 
(-5.6851997, 0.47382858, 2.8603635)
(-5.592414, 0.48771226, 2.9668534)
(-5.5046434, 0.4849484, 3.0675883)
(-5.4140506, 0.48272365, 3.1715624)
(-5.323473, 0.48094493, 3.2755187)
(-5.23291, 0.47951943, 3.3794572)
(-5.142359, 0.478379, 3.4833832)
(-5.051817, 0.47746623, 3.5872982)
(-4.9612823, 0.4767355, 3.6912045)
(-4.8707533, 0.4761535, 3.7951045)
(-4.7802305, 0.47568524, 3.8989983)

Just to clarify, you want your model (which has the control) to face a spatial, or the camera to face it…?

Well I’m using the Chase Camera combined with the BetterCharacterControl.

Currently the model is invisible so it really doesn’t matter which way that faces. More specifically I just want the camera to look at that direction.

Edit:

Really I’d be happy with having any effect on the way the camera faces at this point.

Are you trying to get it like this:
http://static-8.nexusmods.com/15/mods/130/images/34744-1-1287562664.png
And as the player moves it always stays behind them like in the picture?

It’s actually first person and uses the chase cam (for specific reasons).

It looks like the model is rotating to face the right direction. But the camera does not change.

So essentially my physical body is facing the right direction but the camera is not.

So if it were behind his back and the item was the crate in front of him. His body would face the crate but the camera would not.

It is only changing the direction of the view of my player’s model. While I want more of a spin player and camera.

So I guess if the camera were behind him and not in his head. Yes that’s what I’d like.

Like… I set the view of the character control and the camera snaps behind him.

I’m just trying to work out what you want to do so I can help with it, not what is happening now. I’m not gonna lie, I still can’t figure out what you want, perhaps I am being stupid : <

I can’t see any code of yours for the camera, but either way my guess is that what rotation you set for the camera is replaced by the chase camera, which sets the cameras rotation itself.

I think perhaps a better solution would be to not use the chase camera? Again I don’t know what you want, but you could set it’s position according to whatever you want, and then just cam.lookAt(spatial.getPos)

BTW, this isn’t your problem but your view direction is not a direction vector. You should normalize it.

As to your real issue, I agree we need to know why you are using chasecam and more about your problem so we can suggest ways of doing it properly.

In my first code it was normalized but this was just something I crammed into the update loop to try for any effect on the camera.

I might be up too late to try and explain this.

My character is facing the wrong way when the game starts…

I want him to be facing the other way. He’s facing the back wall I want him to face the door.

The reason why I’m using the chase camera is the drag to rotate controls and it automatically stays with the model it technically just follows at a really close distance.

All I want is to be able to set the direction the camera and model is facing.

Like force the player to look at something as the chase camera doesn’t have a look at method.