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): If I add the following code to the car constructor: Code:
self.tempCar.collideBox() however, if I type the following code outside of the car class: Code:
viz.go() 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? |
Can you provide a minimal working sample that reproduces the problem? The following code works for me:
Code:
class Car(viz.VizNode): |
Alright I figured out the problem. It had to do with getting a child object from the model that was imported as a "car". This was code that was in the constructor that I didn't include in my previous post because I didn't think it was important (oops.):
Code:
self.frontWheels = self.tempCar.getChild( '0' + str(randomCar) + 'tyresBack-OFFSET' ) this needed to be changed to: Code:
self.frontWheels = self.getChild( '0' + str(randomCar) + 'tyresBack-OFFSET' ) |
Sorry I forgot, I also had to change the name of the ID parameter in the constructor. It must have been scope problems with tempcar.id or something..
|
All times are GMT -7. The time now is 09:03 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC