16
Support / Camera UP vector
« on: August 11, 2009, 10:47:20 pm »
Hello,
I would like to allow player to move camera around the player's ship to see it from different perspective.
The following image shows what I am planning to do: .
First I have tried to use Camera.lookAt() method, however when I run the game it does not work as I wanted.
It is difficult for me to explain why, so i attached 3 screenshots showing how it works with lookAt() method:
What I want is not to see the effect of rotating ship, but have the effect that player is 'flying' around the ship.
After that I have started playing with Camera.setOrientation() method. I am using following code to calculate direction vector:
It seems to work for me, however I have no idea how to calcluate up vector. If I understand it correctly its purpose is to show the direction where is the 'sky' so it suppose to be a perpendicular vector to direction vector (I have showed it as a small blue line at the first picture). I am trying to make it work a second day but without result Can anyone help me and give a hint how to calculate it?
Thanks,
Wojtek
I would like to allow player to move camera around the player's ship to see it from different perspective.
The following image shows what I am planning to do: .
First I have tried to use Camera.lookAt() method, however when I run the game it does not work as I wanted.
It is difficult for me to explain why, so i attached 3 screenshots showing how it works with lookAt() method:
What I want is not to see the effect of rotating ship, but have the effect that player is 'flying' around the ship.
After that I have started playing with Camera.setOrientation() method. I am using following code to calculate direction vector:
Code: [Select]
SimpleVector direction = object.getTransformedCenter();
direction=direction.calcSub(camera.getPosition());
It seems to work for me, however I have no idea how to calcluate up vector. If I understand it correctly its purpose is to show the direction where is the 'sky' so it suppose to be a perpendicular vector to direction vector (I have showed it as a small blue line at the first picture). I am trying to make it work a second day but without result Can anyone help me and give a hint how to calculate it?
Thanks,
Wojtek