Re: [osg-users] Segmentation fault when I try to assign MatrixD

2012-02-18 Thread Scott Wasinger

 
 Thanks, that's great! But I have one more problem. How can I change
 distance of manipulator? I mean it is connected with node, but it's far
 away. I want to zoom in. And also I don't know how to turn off mouse
 controll...


The osgGA::NodeTrackerManipulator  inherits directly from 
osgGA::OrbitManipulator  which has functionality that among other things can 
change the distance between the manipulator and the node it is tracking 

setDistance (double distance)

I'm not sure what you mean by turn off the mouse control.  Are you trying to 
lock the camera view to a particular view?  I believe that you could lock it by 
setting the heading of the manipulator, but I personally haven't tried this.  
You might find something from what you have inherited in 
osgGA::OrbitManipulator or its parents.

hope this helps.

Scott Wasinger

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45570#45570





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Segmentation fault when I try to assign MatrixD

2012-02-17 Thread Maciej Ciemborowicz

On 15.02.2012 22:48, Scott Wasinger wrote:

Just for some clarification are you trying to make a camera that follows your 
car model?  Because I had the similar issue recently and through my research I 
found I could attach a camera manipulator to a node and the camera will be 
translated relative to the position of the PositionAttitudeTransform.

*Note  I needed to attach the manipulator to a child of the 
PositionAttitudeTransform.  In your case it would be the Node that you loaded 
the model file.


Code:

osg::ref_ptrosgGA::NodeTrackerManipulator  manipulator = new 
osgGA::NodeTrackerManipulator;

manipulator-setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER);
manipulator-setRotationMode(osgGA::NodeTrackerManipulator::TRACKBALL);

osg::ref_ptrosg::PositionAttitudeTransform  vehicleRoot = 
dynamic_castosg::PositionAttitudeTransform *(node);

if(vehicleRoot.valid())
{
manipulator-setTrackNode(vehicleRoot.getTrackerNode());
}




Hopefully this helps with your what your trying to accomplish

Scott[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45496#45496





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Thanks, that's great! But I have one more problem. How can I change 
distance of manipulator? I mean it is connected with node, but it's far 
away. I want to zoom in. And also I don't know how to turn off mouse 
controll...


--
Maciej Ciemborowicz
http://ciemborowicz.pl
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Segmentation fault when I try to assign MatrixD

2012-02-15 Thread Maciej Ciemborowicz

Hello,

I have a class (Car) which extends|osg::PositionAttitudeTransform|. Now 
I want to create camera which has the same position. So I get car's 
matrix in Camera's getMatrix() method:


|matrix=  car-asMatrixTransform()-getMatrix(); // osg::Matrixd* matrix|

At this point I get stack overflow. This is call stack from debugger:

osg::Matrixd::set (this=0x64da90, ptr=0xd8)
osg::Matrixd::Matrixd (this=0x64da90, mat=@0xd8: error reading variable)
Camera::update (this=0x64d970)
Camera::Camera (this=0x64d970, car=0x64b270)
main (argc=1, argv=0x7fffe5d8)

What am I doing wrong? How can I get matrix from PAT in different way?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Segmentation fault when I try to assign MatrixD

2012-02-15 Thread Philipp Moeller
Maciej Ciemborowicz p...@ciemborowicz.pl writes:

 Hello,

 I have a class (Car) which
 extends|osg::PositionAttitudeTransform|. Now I want to create camera
 which has the same position. So I get car's matrix in Camera's
 getMatrix() method:

 |matrix=  car-asMatrixTransform()-getMatrix(); // osg::Matrixd* matrix|

 At this point I get stack overflow. This is call stack from debugger:

 osg::Matrixd::set (this=0x64da90, ptr=0xd8)
 osg::Matrixd::Matrixd (this=0x64da90, mat=@0xd8: error reading variable)
 Camera::update (this=0x64d970)
 Camera::Camera (this=0x64d970, car=0x64b270)
 main (argc=1, argv=0x7fffe5d8)

 What am I doing wrong? How can I get matrix from PAT in different way?

Does asMatrixTransform return a non-NULL pointer?
PositionAttidudeTransform does not inherit from MatrixTransform so that
should not work.

HTH,
Philipp Moeller
GeometryFactory
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Segmentation fault when I try to assign MatrixD

2012-02-15 Thread Scott Wasinger
Just for some clarification are you trying to make a camera that follows your 
car model?  Because I had the similar issue recently and through my research I 
found I could attach a camera manipulator to a node and the camera will be 
translated relative to the position of the PositionAttitudeTransform.   

*Note  I needed to attach the manipulator to a child of the 
PositionAttitudeTransform.  In your case it would be the Node that you loaded 
the model file.


Code:

osg::ref_ptrosgGA::NodeTrackerManipulator manipulator = new 
osgGA::NodeTrackerManipulator;

manipulator-setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER);
manipulator-setRotationMode(osgGA::NodeTrackerManipulator::TRACKBALL);

osg::ref_ptrosg::PositionAttitudeTransform vehicleRoot = 
dynamic_castosg::PositionAttitudeTransform *(node);

if(vehicleRoot.valid())
{
manipulator-setTrackNode(vehicleRoot.getTrackerNode());
}




Hopefully this helps with your what your trying to accomplish

Scott[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45496#45496





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Segmentation fault when I try to assign MatrixD

2012-02-15 Thread Ulrich Hertlein
Hi guys,

On 15/02/12 23:52 , Philipp Moeller wrote:
 I have a class (Car) which extends|osg::PositionAttitudeTransform|.
 Now I want to create camera which has the same position. So I get
 car's matrix in Camera's getMatrix() method:

 |matrix=  car-asMatrixTransform()-getMatrix(); // osg::Matrixd* matrix|
...
 
 Does asMatrixTransform return a non-NULL pointer?
 PositionAttidudeTransform does not inherit from MatrixTransform so that
 should not work.

Also, you may want to use 'osg::Matrix' rather than the explicit 'osg::Matrixd' 
just in
case OSG is not compiled using doubles.

Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org