#1
|
|||
|
|||
Lightwave objects rotation problem
Hello. I have a Lightwave model made up of 50+ objects. All of the objects in this model have a center point of [0,0,0] even though that isn't what I would consider their center of mass. As such, the objects aren't rotating around what would be their visible center.
The creator of the model doesn't know how to change this in his model, and has instead given me the coordinates for each object. Right now I've written a simple Vizard program to load the model and then use getChild to create a node variable for one of the objects. I've tried using the <node3d>.center function to change the pivit point for the object, but it still doesn't rotate around it. Here's my program: Code:
# import the required system functions import viz # start vizard viz.go() # Load the complete bovine model bovine = viz.add('all_centered.lwo') # Move our viewpoint viz.MainView.setPosition(4,0,0) viz.MainView.setEuler(-90,0,0) # get a node for one muscle in the model muscle = bovine.getChild('005') #make the rest of the carcass transparent bovine.alpha(0) muscle.alpha(1) # Marker to show new rotation point MARKER = viz.add('ball.wrl') MARKER.setScale(.25,.25,.25) MARKER.setPosition(.0695,.0346,.7674) print 'My Position: ',muscle.getPosition(viz.ABS_GLOBAL) print 'My Orientation: ',muscle.getEuler(viz.ABS_GLOBAL) print 'Muscle Center: ',muscle.getCenter() print 'Marker Center: ',MARKER.getCenter() muscle.center(.0695,.0346,.7674) print 'My Position: ',muscle.getPosition(viz.ABS_GLOBAL) print 'My Orientation: ',muscle.getEuler(viz.ABS_GLOBAL) print 'Muscle Center: ',muscle.getCenter() print 'Marker Center: ',MARKER.getCenter() ############################################## ## This function deals with keyboard events ## ############################################## def mykeyboard(key): global muscle global MARKER # rotate left if key == 'j': muscle.setEuler(5,0,0,viz.REL_GLOBAL) print "Muscle Center: ",muscle.getCenter() print "Muscle Position: ",muscle.getPosition() # rotate right if key == 'k': muscle.setEuler(-5,0,0,viz.REL_GLOBAL) print "Muscle Center: ",muscle.getCenter() print "Muscle Position: ",muscle.getPosition() # rotate up if key == 'i': muscle.setEuler(0,0,5,viz.REL_GLOBAL) print "Muscle Center: ",muscle.getCenter() print "Muscle Position: ",muscle.getPosition() # rotate down if key == 'm': muscle.setEuler(0,0,-5,viz.REL_GLOBAL) print "Muscle Center: ",muscle.getCenter() print "Muscle Position: ",muscle.getPosition() ####################################################################### viz.callback(viz.KEYBOARD_EVENT,mykeyboard) Thanks in advance for any help I can get. Aaron |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
export problem | bazelaisr | Vizard | 2 | 05-28-2008 10:19 AM |
rotation problem | krimble | Vizard | 1 | 11-21-2007 10:22 AM |
importing a single WRL with many objects. | giancamati | Vizard | 3 | 12-18-2006 01:13 PM |
Could not find plugin to load objects... | halley | Vizard | 1 | 05-30-2006 11:01 AM |
using Lightwave objects | vorin | Vizard | 1 | 01-12-2005 10:15 AM |