Jump to content

[SOLVED] move node question


photo

Recommended Posts

Posted

My English is very poor.

I find nothing code in document whith the Player set the position and viewdirection , example:frist I see A Node(vec3(...)), but now I want to see B Node,I can get B Node( findNode("nodeName")).so I can get B Node vec3,now how can find the B node ViewDirection value. who have code about it . thanks a lot.

Posted

Hello.

 

Have you tried using the following functions in Player class?

 

 

void setFov(float fov)

 

void setUp(vec3 direction)

void setZFar(float distance)

void setZNear(float distance)

Thank you very much. but I don't know that these four paramter value .how and where get.have you example code?

Posted
Are you familiar with perspective projection ? These 4 parameters are the Player's camera options. check this: http://www.dgp.toronto.edu/~karan/courses/csc418/fall_2002/notes/vvol.html

 

sorry! I don't understand the article. (http://www.dgp.toronto.edu/~karan/courses/csc418/fall_2002/notes/vvol.html)

Is looking to A(455,345,335). up vec3(0,0,1) far=60,zfar=10000,znear = 0.1 direction vec3(0,0,-1).

now I want to look to B(5082,4340,379) . how to get the camera paramters? can you give me a compute formula or code sample. Thank you !

Posted
Player player = engine.editor.getPlayer();
vec3 target = vec3(5082, 4340, 379); // B
vec3 direction = target - player.getPosition();
mat4 view = lookAt(player.getPosition(), direction, player.getUp())
player.setModelview(view);

Posted

thanks a lot!

Now i want to ask a question , How can move the camera to B(node) or close with B(node)? because the camera see B is very little dot. have you any method to change the camera position . so . The viewer can look a very big and clear B node.

Posted

Hello,

 

You should call setPosition method to change camera position.

 

Here is modified Carl's code sample:

 

Player player = engine.editor.getPlayer();
player.setPosition(5000, 4200, 300); // place camera near node B
vec3 target = vec3(5082, 4340, 379); // B
vec3 direction = target - player.getPosition();
mat4 view = lookAt(player.getPosition(), direction, player.getUp())
player.setModelview(view);

 

Also, please read this topics:

https://developer.un...rs/class.player

https://developer.un...odes/class.node

Posted

thank you !

Hello, You should call setPosition method to change camera position. Here is modified Carl's code sample:
 Player player = engine.editor.getPlayer(); player.setPosition(5000, 4200, 300); // place camera near node B vec3 target = vec3(5082, 4340, 379); // B vec3 direction = target - player.getPosition(); mat4 view = lookAt(player.getPosition(), direction, player.getUp()) player.setModelview(view); 

Also, please read this topics: https://developer.un...rs/class.player https://developer.un...odes/class.node

 

Thank you very much!

×
×
  • Create New...