Discussion:
[osg-users] Adding Constraints to Draggers
Max Power
2018-10-25 12:56:42 UTC
Permalink
Hi,

I'm quite new to OpenSceneGraph. I actually just finished to read the book "OpenSceneGraph 3.0 Beginner's Guide" and now I want to go a bit further.

Currently, I try to move objects via the mouse. I already saw, that I can use the class osgManipulator::Dragger for this. Here I wrote my own CompositeDragger, which is basically a combination of a RotateCylinderDragger and a Translate1DDrager. This means I can move the object forwards and backwards and I can rotate it via mouse. I already got this working.

However, I don't want to translate the object infinitely forwards or backwards. I just want to translate it e.g. 10 units back or 5 units forward at max. Or I want to translate it only within a certain area of the world coordinate system.

How could I do this? I assume the osgManipulator::Contraint is helpful here. However, I haven't found any examples and I don't know how to apply it.

I hope this wasn't asked before. At least I couldn't find anything similar. Are there any examples somewhere online, which you can recommend to look at?

Thank you!

Cheers,
Max

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75125#75125
Robert Osfield
2018-10-25 15:30:27 UTC
Permalink
Hi Max,

I'm afraid the original author of osgManipulator has moved company, where
he developed it, over a decade ago so to know exactly how to use it we all
just have to look at the code an figure it out. I haven't personally use
osgManipulator in the way you are wanting to use it so can't provide any
guidance myself.

The only public example I'm familiar with is
OpenSceneGraph/examples/osgmaipulator/osgmanipulator.cpp.

Cheers,
Robert.
Post by Max Power
Hi,
I'm quite new to OpenSceneGraph. I actually just finished to read the book
"OpenSceneGraph 3.0 Beginner's Guide" and now I want to go a bit further.
Currently, I try to move objects via the mouse. I already saw, that I can
use the class osgManipulator::Dragger for this. Here I wrote my own
CompositeDragger, which is basically a combination of a
RotateCylinderDragger and a Translate1DDrager. This means I can move the
object forwards and backwards and I can rotate it via mouse. I already got
this working.
However, I don't want to translate the object infinitely forwards or
backwards. I just want to translate it e.g. 10 units back or 5 units
forward at max. Or I want to translate it only within a certain area of the
world coordinate system.
How could I do this? I assume the osgManipulator::Contraint is helpful
here. However, I haven't found any examples and I don't know how to apply
it.
I hope this wasn't asked before. At least I couldn't find anything
similar. Are there any examples somewhere online, which you can recommend
to look at?
Thank you!
Cheers,
Max
------------------
http://forum.openscenegraph.org/viewtopic.php?p=75125#75125
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Max Power
2018-10-25 16:14:43 UTC
Permalink
Hi Robert,

ah okay, I understand. Thank you for your fast reply.

I saw OpenSceneGraph/examples/osgmanipulator/osgmanipulator.cpp and I noticed, that it also uses the Constraint class. However, I don't quite understand it unfortunately. All constrain methods of the class are set to true here and I don't get why this was done. Okay, but then I will try to take a deeper look into the code.

But how is the situation currently? Are osgmanipulator and especially the dragger classes are still used today? Or do most people rather write everything from scratch instead of using osgmanipulator?

Thank you for your help! :)

Cheers,
Max

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75133#75133
Robert Osfield
2018-10-25 16:35:27 UTC
Permalink
Hi Max,
Post by Max Power
But how is the situation currently? Are osgmanipulator and especially the
dragger classes are still used today? Or do most people rather write
everything from scratch instead of using osgmanipulator?
As far as I'm aware osgManipulator is used, it's extensible so it should be
able to extend. I just can't personally guide your extension of it.

Robert.
Garfield Pig
2018-10-26 03:37:30 UTC
Permalink
Hi Max£¬
Robert is right,add constraint to dragger.
You can find the constraint work on command in dispatch method of class Dragger.
As for the example,you can see the class GridConstraint inherited from class Contraint.
Just add breakpoint,and follow the code,you can know how it work clearly.


------------------ Original ------------------
From: "Max Power"<***@hotmail.com>;
Date: Fri, Oct 26, 2018 00:14 AM
To: "osg-users"<osg-***@lists.openscenegraph.org>;

Subject: Re: [osg-users] Adding Constraints to Draggers



Hi Robert,

ah okay, I understand. Thank you for your fast reply.

I saw OpenSceneGraph/examples/osgmanipulator/osgmanipulator.cpp and I noticed, that it also uses the Constraint class. However, I don't quite understand it unfortunately. All constrain methods of the class are set to true here and I don't get why this was done. Okay, but then I will try to take a deeper look into the code.

But how is the situation currently? Are osgmanipulator and especially the dragger classes are still used today? Or do most people rather write everything from scratch instead of using osgmanipulator?

Thank you for your help! :)

Cheers,
Max

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





_______________________________________________
osg-users mailing list
osg-***@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
tom spencer
2018-10-26 14:11:19 UTC
Permalink
Post by Max Power
However, I don't quite understand it unfortunately. All constrain methods of the class are set to true here and I don't get why this was done.
I don't see anywhere in the entire osg project where the return from constrain is used. I don't think it serves any purpose at this point. Constraints manipulate the command to accomplish their task.

Code:
grep -IrnF -- ".constrain" *
include/osgManipulator/Command:61: virtual void accept(const Constraint& constraint) { constraint.constrain(*this); }
include/osgManipulator/Command:112: virtual void accept(const Constraint& constraint) {constraint.constrain(*this); }
include/osgManipulator/Command:149: virtual void accept(const Constraint& constraint) {constraint.constrain(*this); }
include/osgManipulator/Command:188: virtual void accept(const Constraint& constraint) {constraint.constrain(*this); }
include/osgManipulator/Command:233: virtual void accept(const Constraint& constraint) {constraint.constrain(*this); }
include/osgManipulator/Command:278: virtual void accept(const Constraint& constraint) {constraint.constrain(*this); }
include/osgManipulator/Command:314: virtual void accept(const Constraint& constraint) {constraint.constrain(*this); }

grep -IrnF -- "->constrain" *
//returns nothing.
Post by Max Power
But how is the situation currently? Are osgmanipulator and especially the dragger classes are still used today?
I have been using osgmanipulator library and have been happy it is available. https://gitlab.com/blobfish/cadseer/tree/master/library[/url][/code]

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

Continue reading on narkive:
Search results for '[osg-users] Adding Constraints to Draggers' (Questions and Answers)
20
replies
Have any conservatives seen Sicko yet?
started 2007-07-06 11:54:31 UTC
politics
Loading...