WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-24-2010, 12:58 PM
mkmatlock mkmatlock is offline
Member
 
Join Date: Jun 2010
Posts: 6
chain mesh collisions

Hi!

I have a chain link ( a plane, with transparent texturing ). I am trying to make a complete chain out of links programatically.

This works fine, however, when I try to simulate the chain hanging and swaying (by attaching one end to a joint, and setting "Collide Mesh"), vizard locks up completely.

I don't want the chain to bend at each link, just at the point from which it is hanging (the chain is supposed to be under high load, so lots of flopping around would be unrealistic).

I assume vizard locks up because the chainlink meshes technically intersect one another. Is there a way to apply gravity to an object WITHOUT giving it a collide<Type>() command?

Code follows:

Code:
import viz
import math
# distance is meters
# mass is in kilograms
# gravity is 9.81 m/s

viz.go()


viz.phys.enable()
viz.phys.setGravity([0, -9.81, 0])

viz.startlayer(viz.LINE_STRIP)
viz.vertexcolor([1,1,1])
viz.vertex([0,0,0])
viz.vertex([0,0,4])
viz.endlayer()

def create_axes(length, parent):
	viz.startlayer(viz.LINE_STRIP)
	viz.vertexcolor([0,0,1])
	viz.vertex([0,0,0])
	viz.vertex([0,0,length])
	viz.vertexcolor([0,1,0])
	viz.vertex([0,0,0])
	viz.vertex([0,length,0])
	viz.vertexcolor([1,0,0])
	viz.vertex([0,0,0])
	viz.vertex([length,0,0])
	object = viz.endlayer()
	if(parent != 0):
		object.parent(parent)
	return object

def create_chain(length):
	link_count = length / 0.1 + 1
	a = 0
	head = 0
	plink = 0
	while(a < link_count):
		if(head == 0):
			head = viz.add('data\\chainlinks.IVE')
			head.setScale([0.0142,0.0142,0.0142])
			head.collideMesh()
			plink = head
			
		else:
			link = viz.add('data\\chainlinks.IVE')
			link.collideMesh()
			link.parent(plink)
			link.setPosition([0,0,7])
			link.setEuler([0,0,90])
			plink = link
			
		a=a+1
	
	return head
	
	
chain = create_chain(4.0)
#chain.setEuler([0,90,0])
chain.setPosition([0,4,0])

joint = viz.phys.addBallJoint(chain, None, pos = [0,4,0])

create_axes(100, chain)
create_axes(1, 0)

viz.MainView.setPosition([5,2,5])
viz.MainView.lookat([0,2,0])
Reply With Quote
  #2  
Old 08-31-2010, 12:44 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Can you attach the .ive file used for this script or upload to http://www.worldviz.com/support/upload.html?
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
Head mesh indirection Enlil Vizard 2 07-08-2010 08:11 AM
Avatar bones show through Mesh. vEsotu Vizard 3 11-03-2008 11:38 AM
Multiple Mesh Avatar Texturing v-jbinney Vizard 6 11-13-2007 11:00 AM
LOD per individual mesh?? krimble Vizard 4 01-15-2007 04:46 AM
changing the texture of an avatars shirt/body bailenson Vizard 19 05-04-2006 10:00 AM


All times are GMT -7. The time now is 02:15 AM.


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