Author
Topic: alignment of an object3D (Read 12727 times)

how to get and set the alignment of an object3D?. Well for my game I decided to transmit the position and direction of some objects3D istead of the entire World, but I have noticed that the object3D class has no methods to do it, I mean, I can get the position easyly and the axis x, y and z, but how can align an object3D to that values if an object3D can be only aligned to a camera.

Just transfer the rotation matrix of the Object3D on the server (or even simpler: the dump obtained by Matrix.getDump()) and set the client's object rotation matrix to that (Matrix.setDump()). That should do the trick.

Invert the matrix before applying it to the camera.About the axis-thing: Yes, that's the way it's supposed to be. If you need the actual axis of the object, you may get this axis from the object and use the rotateAxis(...)-method instead.

Hi, how can I do it, sorry for asking here a way to do it, but nowadays I have nothing of time for researching this thing. Well, in fact I can obtain the current axis of the object by the getters methods, but how can I align a camera to them. I tried to rotate the camera on x, y and z axis, but the x, y and z axis obtained from the object 3d are relatives and no the proyections over the abosulte axis. How can I do it. Please help.

it still is rotating respect to the absolute world axis. and not to the relative object3d axis.

Of course it is, because that's what it's supposed to do, regardless of alignment/orientation. If you want a different behaviour, you have to use the rotateAxis()-methods, but i'm not sure how this is related to your problem, because i obviously don't understand it correctly.

Well, the problem is that I need to move an object3d. The movement is suposed to be similar to the game descent. in which you can go ahead and back. you can rotate on any axis, to go up, down, left, right, or even to the z axis. So.... The craft can be on any direction and rotated on any axis. so I need to align a camera to that craft. I need a behavior similar to he one obtained with the setBack (Matrix) but the problems is that the rotation is done respect with the absolute world axis and not to the realtive craft axis.

Yeah, I also tried that but the problem is the angle to rotate on that axis, because I would need to have the actual angle proyection from the camera to that relative axis in order to calc the difference angle. I was thinking on getting the x, y and z axis of the object3D, proyect them into the X, Y, and Z absoulte axis and then do a rotate over the 3 absoulte axis. What do you think?

After reading this multiple times, i have to admit...i don't get it... :?: The camera is located inside of the object? The object should perform the same rotations as the camera does? Then why doesn't it work to set the object's rotation matrix to the inverted camera one? And why should the angles with which the camera's rotates be different from the ones used on the object? I don't seem to get the actual problem here.