WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-01-2011, 02:34 PM
fivel_lab fivel_lab is offline
Member
 
Join Date: Mar 2011
Posts: 36
physics problem

hey, first time poster here

currently, i'm trying to setup a balance board type apparatus that includes the board, and a ball that rests on the center. the board tilts up and down and is controlled by a wii remote controller. as the board tilts, the ball rolls down accordingly. all that is working fine and dandy, but a problem keeps occuring where the ball suddenly drops through the board, and i haven't been able to figure out why. i've tried playing with the density, bounce, and hardness of both the board and the ball, but still no luck.

here's my script so far:
Code:
#create balance board
bar = vizshape.addBox(size=(20, 1,1))
bar.setPosition([0,2,5])
bar.color(1,0,0)
barCollideShape = bar.collideMesh()

#create ball
ball = viz.add('ball.wrl')
ball.setScale([1.5,1.5,1.5])
ball.setPosition([0, 7, 5])
ballCollideShape = ball.collideSphere()
as well as the scrip for the wii remote controls:
Code:
#Add wiimote extension
wii = viz.add('wiimote.dle')

#Connect to first available wiimote
w = wii.addWiimote() 
def updateWiiMote():
	w.led = wii.LED_1 | wii.LED_4
	x,y,z = w.getAccel()
	x,y,z = threshIt(x,y,z)

	newEuler = (0,0,-x*10)
	print newEuler
	bar.setEuler(newEuler)
	
	
#poll joystick continuously
vizact.ontimer(0, updateWiiMote)
and i also created "guardrails" in front of and behind the balance board, to keep the ball from rolling off on the z-axis:
Code:
#create rear guiderail
farGuiderail = vizshape.addBox([30, 50, .01])
farGuiderail.setPosition([0,2,5.5])
farGuiderailMesh = farGuiderail.collideMesh()
farGuiderail.disable(viz.RENDERING)
farGuiderail.disable(viz.DEPTH_WRITE)

#creat front guiderail
nearGuiderail = vizshape.addBox([30, 50, .01])
nearGuiderail.setPosition([0,2,4.5])
nearGuiderailMesh = nearGuiderail.collideMesh()
nearGuiderail.disable(viz.RENDERING)
nearGuiderail.disable(viz.DEPTH_WRITE)
any help would be greatly appreciated. thanks in advance
Reply With Quote
 


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
Vizard problem mizutani_jun Vizard 4 01-09-2011 03:39 PM
Physics Problem Sandro Holzer Vizard 4 03-29-2009 10:51 PM
physics engine exception ad_astra Vizard 3 03-25-2009 11:31 AM
picking problem... k_iwan Vizard 2 07-27-2007 07:57 PM
problem with female animations vmonkey Vizard 1 10-07-2005 10:36 AM


All times are GMT -7. The time now is 01:00 PM.


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