ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperLicht
Camera Control
Author Text

Registered User
2015-06-14 22:36:11

I'm working on a project where I'm using a face tracking program. I've managed to get the live data from the tracker, and translate the rotational data of the face to rotational data of the camera, essentially rotating the camera based on the rotation of the user's face.

This has worked fairly well for basically panning and tilt of a fixed camera. I am exploiting the "relativeRotationX" and "relativeRotationY" of the scene's active camera's first Animator. Strangely the camera's first Animator.Type object returns -1.

What I'm after now is a way to add a AnimatorCameraModelViewer to the camera so that it only rotates a fixed radius around the Target. I have not been able to figure out how to add this animator to the scene's current active camera. I have tried the following:

// asume scene and engine are successfully loaded

var activeCamera = scene.getActiveCamera();

console.log(activeCamera.Animators.length) // 1

var newAnimator = activeCamera.addAnimator(CL3D.AnimatorCameraModelViewer(activeCamera, engine));

// newAnimator is undefined

newAnimator = CL3D.AnimatorCameraModelViewer(activeCamera, engine);

//newAnimator is undefined

console.log(activeCamera.Animators.length); // stll 1
console.log(activeCamera.Animators[0].Type); // still returns -1

And I notice no change to the scene camera in my scene.

2015-06-15 06:50:10

You forgot a 'new' there. Use something like this instead:

var newAnimator = activeCamera.addAnimator(new CL3D.AnimatorCameraModelViewer(activeCamera, engine));

Also, it looks like you are having an animator already on that camera. Whatever it is, it is likely that it will interfere with the animator your are adding. Maybe you created an empty scene from CopperCube, and that's that animator which gets added automatically then. Add a camera without an animator in CopperCube, then this won't happen. Alternatively, just remove that animator from the camera.

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "In?ernational" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Software: Ambiera Light Forum. © 2008-2019 Nikolaus Gebhardt, Ambiera e.U.