WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-09-2008, 06:42 AM
theuberk theuberk is offline
Member
 
Join Date: Jul 2007
Posts: 44
inheritence question

Hi,

I'm trying to make custom class called car a subclass of the VizNode class, but I'm having a few problems. Here is the main part of my constructor for the car class:

Code:
class Car(viz.VizNode):
	
	def __init__(self, direction = "right", id = sys.carID):
		
		randomCar = random.randint(1,14)
		
		if (randomCar == 10):
			randomCar += 1	
		if (randomCar > 10):
			self.tempCar = viz.add( "cars\car_" + str(randomCar) + ".ive" )
		else:
			self.tempCar = viz.add( "cars\car_0" + str(randomCar) + ".ive" )
		
		viz.VizNode.__init__( self, self.tempCar.id )
The problem lies in that I cannot seem to manipulate any of the fields present in the VizNode class from outside the car class. For example:

If I add the following code to the car constructor:
Code:
self.tempCar.collideBox()
self.tempCar.setVelocity([10,0,0])
the car will fall and move along the x-axis at 10units/s

however, if I type the following code outside of the car class:

Code:
viz.go()
viz.phys.enable()
car = Car()
car.collideBox()
car.setVelocity([100,0,0])
I get the following error:

Cannot collideBox with invalid bounding box

collideBox is not the only method that does not work. I've also tried methods like car.setPosition(10,0,0) which also does not do anything.

Any ideas?
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
viztask question asimbh Vizard 1 11-20-2007 09:12 AM
Another color question mjabon Vizard 4 07-31-2007 03:04 PM
question about yaw, pitch, roll TunTun Vizard 2 05-23-2007 12:46 PM
to rephrase my question... shai Vizard 2 10-27-2004 10:55 AM
Lots of Question Karthi Vizard 4 02-20-2004 06:42 PM


All times are GMT -7. The time now is 09:58 PM.


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