WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-08-2015, 08:05 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
setPosition() and collision

Hello,

I have a question about the setPosition() function, specifically when using it to move the viewpoint:

when I enable collision for the viewpoint (by viz.MainView.collision(viz.ON)), the setPosition() command will not move the viewpoint when there is an object in the path to the desired position. This is very counter intuitive and has caused me some frustration with a complex scene with complex movement command (I thought the error was in my coding!).

Is there a better way to move the viewpoint around? Right now I have to disable collision and re-enable it whenever I move the viewpoint.

Here is a small example:

Code:
import viz
import viztask
import vizshape

arena = viz.addChild('pit.osgb')

view = viz.MainView
view.collision(viz.ON)

eyelvl = 2

def main():

	view.setEuler(0,0,0)
	view.setPosition([0,eyelvl,0])
	
	yield viztask.waitKeyDown('b')
	
	view.setPosition([0,eyelvl,8])
	
	yield viztask.waitKeyDown('b')
	
	view.setPosition([0,eyelvl,0])
	
	cube1 = vizshape.addBox(size = [1,1,1],splitFaces = True)
	cube1.setPosition([0,eyelvl,6])
	cube1.color(viz.RED)
	
	cube2 = vizshape.addBox(size = [1,1,1],splitFaces = True)
	cube2.setPosition([-2,eyelvl,6])
	cube2.color(viz.GREEN)
	
	yield viztask.waitKeyDown('b')
	
	view.setPosition([0,eyelvl,8])
	
	yield viztask.waitKeyDown('b')
	
	cube2.setPosition([2,eyelvl,6])
	
viztask.schedule(main())

viz.go()
Best regards from Germany,
Johannes
Reply With Quote
  #2  
Old 02-10-2015, 08:45 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
It sounds like you've found a good workaround. I'll let our developers know about this issue and if they have other suggestions I'll reply here.
Reply With Quote
  #3  
Old 02-18-2015, 06:07 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
Thank you!
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
.bsp->.obj->.osgt map Collision Problem/Resources for free maps? plogic Vizard 0 10-24-2014 07:59 AM


All times are GMT -7. The time now is 03:31 AM.


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