WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-15-2013, 08:51 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
Bug in setPosition

I found a bug in the setPosition of Node3D (VizNode)

Code:
import vizshape, viz

viz.go()

vizshape.addGrid()
group1 = viz.addGroup()
group1.setPosition(3.0, 0.0, 10.0)
cube1 = vizshape.addCube(3.0, parent=group1)
cube1.setPosition(0.0,0.0,10.0, mode=viz.ABS_GLOBAL)
cube1.alpha(0.5)

group2 = viz.addGroup()
group2.setPosition(3.0, 0.0, 10.0)
cube2 = vizshape.addCube(2.0, color = (1.0,0.0,0.0), parent=group2)
cube2.setPosition((0.0,0.0,10.0), mode = viz.ABS_GLOBAL)
The following simple example should place the two cubes on the same location. Both use the "mode=viz.ABS_GLOBAL" flag to set the cube on "0.0, 0.0, 10.0" position. The first white cube will be placed correctly the second red cube will be placed relative to the parent.
Reply With Quote
  #2  
Old 10-16-2013, 12:20 AM
Frank Verberne Frank Verberne is offline
Member
 
Join Date: Mar 2008
Location: Netherlands
Posts: 148
If you change:
Code:
cube2.setPosition((0.0,0.0,10.0), mode = viz.ABS_GLOBAL)
to:
Code:
cube2.setPosition(0.0,0.0,10.0, mode = viz.ABS_GLOBAL)
then both cubes are set in the same position. Apparently, there's a difference between node.setPosition((0.0,0.0,10.0)) and node.setPosition(0.0,0.0,10.0).
Reply With Quote
  #3  
Old 10-18-2013, 02:25 AM
sleiN13 sleiN13 is offline
Member
 
Join Date: Dec 2008
Posts: 83
You would expect it to just work. Took me hours to figure out that this was the cause of my problem. I don't know on how many other locations in my code I might have used this construction.
Reply With Quote
Reply

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
about setPosition xingxing Vizard 2 02-20-2008 10:32 AM


All times are GMT -7. The time now is 03:39 PM.


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