WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-16-2012, 06:18 AM
torbeng torbeng is offline
Member
 
Join Date: Apr 2012
Posts: 11
<node3d>.save() position and rotation

I'm currently trying to apply some transformations (scale, position, rotation) to a model and save it to an .ive file using <node3d>.save(). However, all of these transformations are lost when I open the file.
I played around with the different modes for setting a position, e.g. setPosition(0,0,10,mode=viz.REL_LOCAL), but it does not seem to have any effect. Is there any way to save the model with these transformations applied? Thank you very much for your help in advance.
Reply With Quote
  #2  
Old 04-16-2012, 07:33 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The <node3D>.save command will save a node to either the .ive or .osg format. Transformations made to the node will not be saved.

You'll need to apply the transformation in some modeling software and then export a new version of the model.
Reply With Quote
  #3  
Old 04-16-2012, 09:23 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
If you parent the model to a group node, then saving the group will preserve the transformation of the model. Example:
Code:
import viz
viz.go()

root = viz.addGroup()
model = viz.add('dojo.osgb',parent=root)
model.setEuler(180,0,0)

root.save('dojo_rotated.osgb')
Reply With Quote
  #4  
Old 04-16-2012, 09:42 AM
torbeng torbeng is offline
Member
 
Join Date: Apr 2012
Posts: 11
Thanks a lot, this seems to work, at least with some models. For some reason, it does not work with all - I'll have to investigate a bit. Maybe it is a format-specific glitch. Here is an example:

Code:
import viz
viz.go()

root = viz.addGroup()
model = viz.add('dojo.osgb',parent=root)
model2 = viz.add('table.wrl',parent=root)
model2.setPosition(2,2,2)
model.setEuler(99,0,0)
model.setPosition(1,1,1)
root.save('dojoandtable.ive')
root.remove()
viz.add("dojoandtable.ive")
If you comment out the last two lines, the table is floating in the air. If you don't, the table is one the floor.
Reply With Quote
  #5  
Old 04-16-2012, 09:49 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Sorry, I forgot to mention that this will only work with the newer osgb format.
Reply With Quote
  #6  
Old 04-16-2012, 10:24 AM
torbeng torbeng is offline
Member
 
Join Date: Apr 2012
Posts: 11
Oh, thanks, that clears things up. However, once I have all my models saved as osgb, I cannot open them with any program. Even osgconv fails to convert these models to any other file (including the differnet osg file formats). Do you know of any software product that can successfully open osgb files generated by Vizard except for Vizard?
Reply With Quote
  #7  
Old 04-16-2012, 10:53 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Unfortunately you won't be able to load the models within an external program. Vizard uses its own osg::Transform derived class for transforming models, so this class can only be serialized within Vizard.
Reply With Quote
  #8  
Old 04-18-2012, 10:17 AM
torbeng torbeng is offline
Member
 
Join Date: Apr 2012
Posts: 11
Thanks for your help. Does WorldViz have any plans to make a working export/save function a feature of future versions of Vizard?
Reply With Quote
Reply

Tags
position, rotation, save, scale, transformation

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
limiting object rotation Philippe Vizard 5 10-07-2010 05:31 PM
Semi-circle array containing target and distractor objects ptjt255 Vizard 3 08-04-2009 04:09 AM
Lightwave objects rotation problem hosier Vizard 6 02-13-2009 01:04 PM
Can you link the position of a tracker to the orientation of an object? michaelrepucci Vizard 1 09-19-2008 11:23 AM
getting absolute rotation tavaksai Vizard 1 08-03-2004 02:40 PM


All times are GMT -7. The time now is 10:26 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC