WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 19 votes, 5.00 average. Display Modes
  #1  
Old 02-17-2006, 12:36 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Question Collidesphere

I have this bit of code that I am using from the duckcourt example. I can't find anything on the help that deals with collidesphere. Where did that come from and what does it mean.

Thanks

Code:
	#Enable collisions with the ball based on a sphere shape
	ball.collidesphere(0.25)
	ball.isTarget = 0
	collidables.append(ball)
Reply With Quote
  #2  
Old 02-17-2006, 02:04 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The command tells Vizard to use a sphere with radius 0.25 when checking collisions with the objects using the collidingwith command. The collide functions are currently undocumented. Let me know if you want more information.
Reply With Quote
  #3  
Old 02-24-2006, 01:16 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
I was wondering if you could help me out. I'm trying to add an animation where, if I click on an avatar, it falls to the ground and disappears. I got the falling part down, but I added the fadeReset sequence to try and delay the disappearing and it doesn't work out. Any ideas?
Code:
def onmousedown(button):
	if button == viz.MOUSEBUTTON_LEFT:
		node = viz.pick() #Get object that was clicked
		if node in avatars: #Check if object is one of the avatars
			node.clear(viz.ALL)
			node.clear(viz.CURRENT_ACTION)
			node.execute(7) #Execute the "shot" animation
			#Create action to wait for the animation duration then freeeze the avatar
			WaitThenFreeze = vizact.sequence( vizact.waittime(node.getduration(7)-.139), vizact.speed_node(0))
			fadeReset = vizact.sequence(vizact.waittime(5),node.remove())
			#vizact.sequence(vizact.waittime(2),avatars.remove(male),1)			
			node.add(WaitThenFreeze) #Add the action to the avatar
			node.add(fadeReset)
Reply With Quote
  #4  
Old 02-24-2006, 02:09 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The problem is that you are calling node.remove(). This function will immediately delete the object. In this example you need to create an action that will remove the node. Use the following code instead:
Code:
fadeReset = vizact.sequence(vizact.waittime(5),vizact.call(node.remove))
The vizact.call action will simply call the function that you pass to it.
Reply With Quote
  #5  
Old 02-27-2006, 01:00 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
I think it's working out but I do get some traceback errors. Here is the code:
Code:
def onmousedown(button):
	global i
	if button == viz.MOUSEBUTTON_LEFT:
		node = viz.pick() #Get object that was clicked
		if node in avatars: #Check if object is one of the avatars
			node.clear(viz.ALL)
			node.clear(viz.CURRENT_ACTION)
			node.execute(7) #Execute the "shot" animation
			#Create action to wait for the animation duration then freeeze the avatar
			WaitThenFreeze = vizact.sequence( vizact.waittime(node.getduration(7)-.14), vizact.speed_node(0))
			#vizact.sequence(vizact.waittime(2),avatars.remove(male),1)			
			node.clear(viz.ALL)
			node.clear(viz.CURRENT_ACTION)
			node.add(WaitThenFreeze) #Add the action to the avatar
			node.clear(viz.ALL)
			node.clear(viz.CURRENT_ACTION)
			fadeReset = vizact.sequence(vizact.waittime(1),vizact.call(node.remove))
			node.add(fadeReset)
		i = 2;
Here are the traceback errors. I'm not sure what they all mean.

Code:
Traceback (most recent call last):
  File "C:\Program Files\Vizard25\viz.py", line 5916, in mytimer
    curAction.update(elaps,curAction._obj_)
  File "C:\Program Files\Vizard25\vizact.py", line 653, in update
    self.checkaction(object)
  File "C:\Program Files\Vizard25\vizact.py", line 629, in checkaction
    __endAction__(object,self.curAction)
  File "C:\Program Files\Vizard25\vizact.py", line 219, in __endAction__
    object._action.notifyEndAction(action._obj_,action._actiondata_.callbackData,action._pool_)
AttributeError: 'int' object has no attribute 'notifyEndAction'
Reply With Quote
  #6  
Old 02-27-2006, 01:32 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Try the following instead:
Code:
node.add(vizact.waittime(1))
node.add(vizact.call(node.remove))
Reply With Quote
Reply


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


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


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