OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Adding Constraints to Draggers


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
bam098
Newbie


Joined: 25 Oct 2018
Posts: 2

PostPosted: Thu Oct 25, 2018 12:56 pm    Post subject:
Adding Constraints to Draggers
Reply with quote

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
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Oct 25, 2018 3:31 pm    Post subject:
Adding Constraints to Draggers
Reply with quote

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.



On Thu, 25 Oct 2018 at 15:50, Max Power < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
bam098
Newbie


Joined: 25 Oct 2018
Posts: 2

PostPosted: Thu Oct 25, 2018 4:14 pm    Post subject:
Reply with quote

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? Or is there even another (newer) library for mouse dragging?

Thank you for your help! Smile

Cheers,
Max
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12145

PostPosted: Thu Oct 25, 2018 4:36 pm    Post subject:
Adding Constraints to Draggers
Reply with quote

Hi Max,

On Thu, 25 Oct 2018 at 17:20, Max Power < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:

Quote:
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.

 

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Garfield Pig
Guest





PostPosted: Fri Oct 26, 2018 3:38 am    Post subject:
Adding Constraints to Draggers
Reply with quote

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"<>;
Date: Fri, Oct 26, 2018 00:14 AM
To: "osg-users"<>;

Subject: Re: 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! Smile

Cheers,
Max

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







------------------
Post generated by Mail2Forum
Back to top
blobfish
Newbie


Joined: 14 Sep 2016
Posts: 10

PostPosted: Fri Oct 26, 2018 2:11 pm    Post subject:
Reply with quote

bam098 wrote:
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.






bam098 wrote:
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]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts osgUtil Delaunay and a bit complex in... Trajce Nikolov NICK General 2 Tue Jul 10, 2018 11:06 am View latest post
No new posts Adding primitiveset in runtime sergio2k18 General 7 Tue May 01, 2018 9:12 pm View latest post
No new posts CompositeViewer:: checkNeedToDoFrame(... makulis General 3 Sun Sep 24, 2017 9:26 pm View latest post
No new posts Adding WOFF extension to freetype plugin robertosfield Submission 0 Mon Jul 17, 2017 3:48 pm View latest post
No new posts osgUtil::Delaunay* question (where is... Trajce Nikolov NICK General 2 Fri Nov 11, 2016 6:19 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP