www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: bionicoz on April 18, 2011, 04:51:41 pm
-
I need some method to smooth move my camera to a point in my world. I thought that the right way to do this was extending Camera class.
I did the nearly same thing with the 3DObject class. I added some methods and some fields. And everything works.
But when i do this:
myCamera cam = (myCamera)world.getCamera();
I get a Cast Error. I'm not a guru with Java, but I cannot understand why with 3DObject class is working and with Camera is not.
Any suggestion? Maybe a better way to add this functionality to my cam?
ty all.
-
You can't anything to a type that isn't of that type. Create an instance of your extended camera yourself and set it to the world via setCameraTo(...);
-
try to put the jpct camera in the constructor of myCamera
private cam = null;
public myCamera(camera cam){
this.cam = cam;
}
now you can use this.cam in your class..
and call it by using
MyCamera myCamera = new myCamera(world.getCamera());
something like that.
-
I got it working using Egon solution, but just for simplicity. Kaiidyn's one is working too.
Thanks for the great support you all offer in this forum.