@@ -43,8 +43,19 @@ abstract class CameraController extends h3d.scene.Object {
4343 var pushTime : Float ;
4444 var startPush : h2d.col. Point ;
4545
46- public function new (? parent : h3d.scene. Object ) {
46+ public function new (? distance : Float , ? parent : h3d.scene. Object ) {
4747 super (parent );
48+ set (distance );
49+ curPos .load (targetPos );
50+ curOffset .load (targetOffset );
51+ }
52+
53+ public static function getCameraControllersClass () : Array <Class <h3d.scene. CameraController >>{
54+ return [OrbitCameraController , FPSCameraController ];
55+ }
56+
57+ public static function getCameraControllerClassIdx (ctrl : h3d.scene. CameraController ) {
58+ return h3d.scene. CameraController .getCameraControllersClass ().indexOf (Type .getClass (ctrl ));
4859 }
4960
5061 override function onAdd () {
@@ -259,11 +270,8 @@ class OrbitCameraController extends CameraController {
259270 var moveCount = 0 ;
260271
261272 public function new (? distance : Float , ? parent : h3d.scene. Object ) {
262- super (parent );
273+ super (distance , parent );
263274 name = " OrbitCameraController" ;
264- set (distance );
265- curPos .load (targetPos );
266- curOffset .load (targetOffset );
267275 }
268276
269277 override function onEventInternal ( e : hxd. Event ) {
@@ -366,8 +374,8 @@ class FPSCameraController extends CameraController {
366374 public var zFar = 10000.0 ;
367375 public var snapToGround = true ;
368376
369- public function new (? parent : h3d.scene. Object ) {
370- super (parent );
377+ public function new (? distance : Float , ? parent : h3d.scene. Object ) {
378+ super (distance , parent );
371379 name = " FPSCameraController" ;
372380 }
373381
0 commit comments