WorldViz User Forum How can I apply physics to Donut or Ring?
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

 Thread Tools Rate Thread Display Modes
#1
06-18-2012, 02:41 AM
 goro Member Join Date: May 2012 Posts: 33
How can I apply physics to Donut or Ring?

In Vizard we have collide shapes for our physical objects
collideBox
collideSphere
collideCapsule
collideMesh
collidePlane

collideBox, collideSphere & collideCapsule can get affected by dynamic forces like gravity but collideMesh objects are unaffected by forces and can only provide a solid collision area for other objects. I want inner side of donut or ring too to have physical properties. Can you help me with the logic to get this thing done?
#2
06-27-2012, 02:32 PM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
There is no built-in torus shape in the physics engine, but you can approximate one using multiple sphere shapes. Here is a sample script that simulates a torus using 18 spheres:
Code:
```import viz
import math
import vizact
import vizshape

viz.go()

viz.phys.enable()

ground = viz.addChild('ground.osgb')
ground.collidePlane()

RADIUS = 1.0
TUBE_RADIUS = 0.5

torus = vizshape.addTorus(radius=RADIUS,tubeRadius=TUBE_RADIUS)
for deg in range(0,360,20):
x = math.sin(viz.radians(deg)) * RADIUS
z = math.cos(viz.radians(deg)) * RADIUS
torus.collideSphere(radius=TUBE_RADIUS,pos=(x,0,z))

ball = vizshape.addSphere(radius=0.6)
ball.collideSphere()

def Reset():
torus.setPosition([0,2,10])
ball.setPosition([0.6,5,10.6])

vizact.onkeydown('r',Reset)

Reset()```

 Tags collide, donut, physical, physics, shape

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post EnvisMJ Vizard 5 12-29-2011 11:34 AM nige777 Vizard 4 06-22-2009 05:21 PM jalvarez Vizard 3 07-16-2008 04:03 PM joeymax Vizard 2 04-17-2008 03:49 PM adimov Vizard 2 07-22-2004 01:33 PM

All times are GMT -7. The time now is 07:12 AM.

 Contact Us - WorldViz Home - Archive - Top

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