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 

Absolute final world position matrix (Solution)


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


Joined: 26 Jan 2017
Posts: 78

PostPosted: Mon Sep 24, 2018 11:25 am    Post subject:
Absolute final world position matrix (Solution)
Reply with quote

Hi,

I have intermediate exp with the Osg, but this question right here just eludes me.

I've been using the following snippet to get a final world position
Code:
n.getBound().center() * computeLocalToWorld(n.getParentalNodePaths()[0]));


This works correctly some of the time, e.g. for a shallow scene, or one that is freshly imported from an .obj loader, etc.

But things go awry when nesting Pats, and will returns 'doubly multiplicated' coordinates or otherwise just coords that make no sense to me.

Is there a real surefire way to get the absolute / world coordinates from a node / pat?

Alternatively, could I be doing something wrong? I have several pats and nodes inside of eachother, and maybe something is bad.

Thank you!

Cheers,
Johny


Last edited by Steal on Mon Sep 24, 2018 4:37 pm; edited 2 times in total
Back to top
View user's profile Send private message
Steal
User


Joined: 26 Jan 2017
Posts: 78

PostPosted: Mon Sep 24, 2018 4:33 pm    Post subject:
Reply with quote

Hi,

Like this unanswered thread from 2011 suggests, replacing the bounds center with a vec3(1,1,1) is much better.
Code:
Vec3(1,1,1) * computeLocalToWorld(pat->getParentalNodePaths()[0]);


This gives me the result I'm looking for.

Thank you!

Cheers,
Johny
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 Model matrix kullboys General 0 Tue Aug 21, 2018 7:10 am View latest post
No new posts How to create a 3D ray from cursor po... Waaayoff General 2 Mon Jul 16, 2018 3:34 pm View latest post
No new posts EXTERNAL: Re: World space normal. Rowley, Marlin R General 1 Wed Jul 11, 2018 4:30 pm View latest post
No new posts World space normal. Rowley, Marlin R General 4 Wed Jul 11, 2018 1:18 pm View latest post
No new posts Stuck with applying an offset to proj... wernerM General 5 Mon Jun 25, 2018 10:11 am 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