Hi Gianni,

so as I understand you you have one scene but you want to have a different
representationsof the objects from the main scene into the map scene. I
would do it with updateCallback. Let say you have a car that
MatrixTransfrom is moving in the main scene. And you want icon in the map
scene but following an object from the main scene. So let say:

main view:
MatrixTransform * mainSceneObject = ....

map view:
MatrixTransofrm* mapSceneObject (this one with scale but following an
object from the main scene).

you do updateCallback on the mapSceneObject where you simply copy the
matrix from the main scene for translation and use a scale, like

class FollowNodeFromMainSceneNodeCallback : public osg::NodeCallback
{
public:
FollowNodeFromMainSceneNodeCallback(osg::MatrixTransform* mxt)
: _mainSceneObject(mxt) {}

virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osg::MatrixTransform* mapSceneObject =
dynamic_cast<osg::MatrixTransform*>(node);
mapSceneObject->setMatrix(osg::Matrix::scale(x,y,z)*_mainSceneObject->getMatrix().getTrans());
}
protected:
osg::MatrixTransform* _mainSceneObject;
};

and you do then mapSceneObject->setUpdateCallback( new
FollowNodeFromMainSceneNodeCallback(mainSceneObject);

this way you have two MatrixTransoform for the same object across the
scenes, one following the other plus scale.



On Wed, Oct 30, 2013 at 10:36 AM, Gianni Ambrosio <ga...@vi-grade.com>wrote:

> Hi Nick,
> I'm not sure the point is the type of node used. I try to explain in
> detail.
>
> Basically I would like to use the same sub-scene that represents my moving
> object both on the main 3D view and on the track map.
>
> A moving object is insert in the scene of the main view. It can be scaled
> and its transformation matrix changes during animation. The transformation
> is a PositionAttitudeTransform but a MatrixTransform should work the same.
> The problem is now related to the fact I would like to add the root node of
> the sub-scene also to the root node of the track map view. That is useful
> since updated transformations for the moving objects are automatically
> reflected on the track map. That means the moving object moves correctly on
> the track. But the track map view is much smaller than the main view. So
> that, if the track graphics is fine, the moving objects on the track are
> too small to be seen. So I need to scale the moving object on the track map
> view, but without changing the scale on the 3D main view nor on the
> transformation that must move correctly also on the track map view.
>
> Regards
> Gianni
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57003#57003
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
trajce nikolov nick
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to