www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: brunotrodrigues on April 04, 2012, 05:09:30 pm

Title: Extending Object3D
Post by: brunotrodrigues 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?
Title: Re: Extending Object3D
Post by: EgonOlsen 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
...
}
Title: Re: Extending Object3D
Post by: brunotrodrigues on April 05, 2012, 01:59:54 pm
 :-[ (Such a beginner mistake)

That worked like a charm. Thanks a lot!