WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-09-2009, 11:57 AM
hosier hosier is offline
Member
 
Join Date: Feb 2007
Posts: 31
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)
Am I missing something, or could it be because of the model? I can upload that if need be.

Thanks in advance for any help I can get.

Aaron
Reply With Quote
 

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
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


All times are GMT -7. The time now is 03:32 AM.


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