Hi Carsten,
> using makeCoredNode<T>(&core) creates a new node and new core of type T
> and stores a pointer to it in the argument. Since you already create the
> cores by hand you should use makeNodeFor(NodeCore* core) instead.
> Alternatively remove the lines that create _material and _transform and
> let makeCoredNode create them.
thanks. i change the code as you recommended.
>> setPose()
>> {
>> // caluclate q1 to q4
>> _transform->editMatrix().setTranslate(pose.position.x, pose.position.z,
>> pose.position.y);
>> _transform->editMatrix().setRotate(OSG::Quaternion(q1, q2, q3, q4));
>> }
>>
>> the first call of setPose in the constructor works, but calling it after
>> that again, does not result in a change of the position. i had it working at
>> some point, but after stripping my code, i can't get it back to work.
>
> hmm, I don't see anything wrong with the code you posted (unless it has
> to do with the double creation of some cores mentioned above). Are you
> sure pose and q1 to q4 are updated so you actually set new data when
> calling setPose?
the first call works, and in the subsequent calls, i print debug data, which
show that the pose has changed. i have now added the following code to see if
the changes are actually accepted by "transform".
OSG::Matrix m = transform->getMatrix();
OSG::Vector<OSG::Real32,3> position;
OSG::Quaternion rotation;
OSG::Vector<OSG::Real32,3> scale;
OSG::Quaternion scaleOrientation;
OSG::Vector<OSG::Real32,3> center;
m.getTransform(position, rotation, scale, scaleOrientation, center);
cout << position << endl;
it turns out, they are. the values in m.getTransformation --> position are the
same as in my pose.position.
i paste the entire code in:
http://pastebin.com/9pLeP1ZL
(its not that big)
the function update() is called from outside periodically.
cheers,
keyan
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users