You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
I'm not sure that I understand why you parent the nodes everytime you want to
rotate a part of the body. And why do you change position of the nodes, when you only want to rotate them?
And why do you calculate the angles through matrices? Wouldn't vectors be sufficient?
Well for starters, I'm debugging it so it looks that way...because the main problem is that when I'm rotating a mesh it rotates not on its own but according to the origin coordinates...this is why I'm trying to change its position and rotating it and back again...Sadly, it still doesnt work or my algo is just wrong...
Well I'm desperate so I've matrices to create another solution but at first it was the vectors...that is why there is a lot of "//" since I'm trying a lot of things out but still ahvent worked...
I'm desperate for a solution and I've run out of ideas...I need help...
Say I've got a box at position 5,5,5. I want to rotate it in place 45 degrees. I translate it to the origin, then I rotate it, then I translate it back to 5,5,5 by building a matrix stack, in the example above that stack is fixmat.
The OpenGL red book has a great discussion on matrix stacks.
-what are the variables? matrix4?
-what does the variables contain?
-why /2?
sorry, this piece of code is out of context. Now that I think of it, this is probably useless to show. Probably best to ignore it. It does show how to create your stack in Irrlicht, via matrix operator *. Matrix4 is the Irrlicht matrix class, part of core:
Anonymous wrote:how do u get the origin because when I'm using
setPosition(vector3df(0.0, 0.0, 0.0));
it still wont go to the origin...
You're parent child setting in the beginnig of you're function seems traceable.
As I understand it, using setPosition(..) on a scenenode set's the relative position according to the parent. If origin of parents coordinate system differs from the global origin, I would expect all relativ transforms to act in the parent's coordinate frame. Also you could use getAbsolutePosition() to retrieve global coordinates. Anyway setting global coordinates of a scenenode, are allways transformed by the parent's coords (if the's a parent) in the OnPostRender() call.
I'm worse than a dog with a bone. Here's a simple spinning cube, spinning around its center point, and the cube is not at the origin.
This probably isn't what you are talking about, but may be you can use it to get at what you need. The motor example is way too complex for me. See if this helps or rewrite it to illustrate your issue and maybe I can figure out whats up.
Problem is that the meshes always say that they are on 0,0,0 even when Absolute and Relative is used...and still they are not rotating on place...when I move them to the original 0,0,0 (got the coordinates when I was doing the model in 3D Studio Max) and still wont work...
BTW, I had a problem like this, its seems that modifications to a node won't stick unless you issue updateAbsolutePosition. I had a box that newton was bouncing all over the place but irrlicht thought it was a 0,0,0. Sounds like something similar, perhaps?