We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! in this occasion i`ve a difficult to implement a mouse3D spaceNavigator as a free Camera (like the viewer example from the spaceNavigator software or any other example for this type of camera). when i worked with peasyCam, the lookAt vector was for default the center of the scene. In the spaceNavigator viewer the target was upload (and displayed with a little box) according the camera "navigates". This is what i was trying to do, use the spaceNavigator to navigate the 3D world moving the camera around the 3d shapes. Nevertheless, im a little bit lost and i don't know exactly how calculates the coordinates and the transformations for the camera. this is only the Camera-Player class with the spaceNavigator inputs (post only the class assuming that not everybody has a spaceNavigator) in the comments the description of the spaceNavigator manual for everyValue. Also, Every value is from negative 0.538 to positive 0.538 mapping as left-right, up-down, in-out, etc; I really appreciate some kind of help. Thank you very much
class Player {
PVector pos;
PVector lookAt;
PVector up;
PApplet parent;
Player(PApplet p) {
pos = new PVector(0, 0, 0);
lookAt = new PVector(0, 0, -100);
up = new PVector(0, 1, 0);
}
void update() {
beginCamera();
float xx = (Float)spaceNavigator.get("x"); // Right/Left: Moves (pan) the model or document right and left
float yy = (Float)spaceNavigator.get("y"); // Up/Down: Moves (pan) the model or document up and down
float zz = (Float)spaceNavigator.get("z"); // In/Out: Zoom the model or document in and out
float rx = (Float)spaceNavigator.get("rx"); // Tilt: Tilts the model or scene forwards and backwards
float ry = (Float)spaceNavigator.get("ry"); // Spin: Spins the model or scene like a top
float rz = (Float)spaceNavigator.get("rz"); // Roll: Rolls the model or scene sideways
float b0 = (Float)spaceNavigator.get("b0"); //button
float b1 = (Float)spaceNavigator.get("b1"); //button
camera(pos.x, pos.y, pos.z, lookAt.x, lookAt.y, lookAt.z, up.x, up.y, up.z);
endCamera();
}
}
Answers
Like QueasyCam (https://github.com/jrc03c/queasycam) available in the PDE's Library manager?
Kf
mm. yes, kind of. is really impressive and confortable the way that you can use the spaceNavigator to control a camera. the perfect example is the viewer of the spaceNavigator application. what i want is emulate that.
https://www.3dconnexion.com/fileadmin/templates/images/3dx_category_page/3DX_SN_960.mp4 another example.
this is full code. also notice that this implemantation(taken from a web example) allows only change one parameter at time (x , or y, or rx, etc). this is a problem to resolve and i don't know how.
Can you Look at the source code of the library?
Also did you see code examples that come with your 3D mouse?
i didn't find any code in the soft or the manual. the "Viewer" is an application, like an example where you can practice the spaceNavigator skills. (just a 3d Model in the center of the scene). The viewer camera do exactly what mouse tells that do (when you press the X axes, moves to x Axes.. etc, ) but the nice thing is that when you moving, the argument "lookAt" or "center of the scene" is updating according the rotate and position. so is the effect of freely camera. and that i need program in processing, but i don't know exactly calculate that.
isn't the source code of the library published on github? see website?
i downloaded a idk manual and some c++ code. it seems a guide to implement spaceNavigator. but i know the values and what i need is to map that in to a camera... i try this, trying to simulate queasyCam but still don't work properly. in QueasyCam when you move the mouseX is map the "pan" value. This is the same that when you rotateY axes in spaceNavigator viewer. i need to find the algorithm to map the values properly.:
do you want camera mode OR object mode?
Camera mode!
any other suggestion? i could resolve how move two axis at the same time (just clicking a option in spaceNavigator interface).. so, i need the math to calculate the eye view point according the value given
https://azerdark.wordpress.com/2010/01/09/fps-camera-algorithm/ i found this. it seems like a nice source to have in mind.
Can you post your entire code please?
To understand the 3D mouse you should use println to look into the values you receive. E.g. the rotations : are the -1,1,0 only like with the mouse wheel on a 2D mouse? Or do deliver values between 0 and two PI? Or between 0 and 360 degrees?
the values are between -0.538 and -0.538
I don't have your 3D mouse, so I can't really help you
here is a new version where I tried to use mouse to rotate around center and wasd to move
I hope this helps
here is a similar version with wasd and better camera (more like in a first person shooter where you can run where you look and can run sideways)
You may also be interested in the FPS MazeRunner example for the QuesyCam library.
this is finally my player cam. but i have a clip problem on rx`s exes. when i rotate round 180º the image dissapear.. i think is a perspective problem. anybody has an idea? i want free rotating in all exes.
Please note that there is a new forum
You may ask there briefly and link back to here
i also post there. but it has no answer and this is the original post..sorry
I see !
See
https://forum.processing.org/one/topic/clipping-planes.html
mm.. i saw that the problem is when "tilt" is 90 degrees.
but i cant resolve the problem..
Can you post a runnable version and not a part?
an entire sketch that shows your Problem?
yes, i can. but i didnt becouse i use a SPACENAVIGATOR mouse, and if you don have it the class will not work... hope that you can help me in what it see is a mathematical issue.
I don’t have such a mouse
To get help, you would need to write a running version based on a conventional mouse
You have asked in the new forum
I don’t know the math
Maybe you rotate the scene in a way that it is behind the camera and not before it anymore? Try make the radius smaller or camera farer away. A negative Z is more far inside the screen (away from you) as far as I know
spaceNavigator:
what does x,y,z and rx ry rz and b0 and b1 mean / signify?
Is it mouse pos in 3D and rotation in 3D and buttons 1 & 2?
What do you want to achieve?
Do you want to move the camera accordingly to these values (looking at the center of the scene) ?
OR do you want to move / rotate the player accordingly to these values (and the camera is fixed)?