Author Topic: Extending Object3D  (Read 980 times)

Offline brunotrodrigues

  • byte
  • *
  • Posts: 20
    • View Profile
Extending Object3D
« on: April 04, 2012, 05:09:30 pm »
How can I do this?
I'm trying to extend it like this:

Code: [Select]
import com.threed.jpct.Object3D;

public class Unit extends Object3D{

public Unit(String textureName){
...
CODE
...
}
}

And I get the error "no suitable constructor found for Object3D."
Help?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12011
    • View Profile
    • http://www.jpct.net
Re: Extending Object3D
« Reply #1 on: April 05, 2012, 08:54:42 am »
As always when extending classes in Java, you have to make sure that the constructor of the super class that you are calling exists. You are implicitly calling the default constructor, which Object3D doesn't have. Use some constructor that Object3D actually does have...like...

Code: [Select]
public Unit(String textureName){
super(...);
CODE
...
}

Offline brunotrodrigues

  • byte
  • *
  • Posts: 20
    • View Profile
Re: Extending Object3D
« Reply #2 on: April 05, 2012, 01:59:54 pm »
 :-[ (Such a beginner mistake)

That worked like a charm. Thanks a lot!