ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator turn cam slightly down - permanently
person icon
KK
Guest
Quote
2011-06-23 12:45:38

I want to achieve that the camera is always faceing slightly to the ground. I waste space because I have nothing interesting above "2,5m".. Therefore I want the cam to turn 20° down, permanently - without to be able to vertically move the cam..

Any hints how to get this started?

person icon
KK
Guest
Quote
2011-07-11 17:22:40

Im still wondering how to do this. I have the following code:
var animator = new CL3D.AnimatorCameraFPS(cam, engine);

animator.MoveSpeed = 0.2;
animator.RotateSpeed = 250;
animator.setLookByMouseDown(false);

animator.lookAt(new CL3D.Vect3d(0,-20,0));
animator.NoVerticalMovement = true;

cam.addAnimator(animator);

scene.getRootSceneNode().addChild(cam);
scene.setActiveCamera(cam);
But this is not working. The cam is tilted by a vector of -20 but I can still move the camera vertically.. I would like to achieve this effect but without to be able to move the cam vertically..
Maybe someone knows what is missing here?! emoji icon_blink

person icon
niko
Moderator
Quote
2011-07-13 06:13:14

It's not easy to do this using the existing animator, and I'm not quite sure if at all. What you could try to do is to set the target of the camera slightly down after the animator is done, like in the OnBeforeDrawAll handler. Not sure if this will work though.

person icon
KK
Guest
Quote
2011-07-13 15:37:02

I understand. Thanks anyway.. I´ll give it a shot

person icon
KK
Guest
Quote
2011-08-11 18:18:37

I tried to do this. As you said its not easy to do and I think my code is crappy..
var engine = startCopperLichtFromFile('3darea', 'copperlichtdata/TiltCam.ccbjs');

engine.ingComplete = function()
{
var scene = engine.getScene();
scene.setRedrawMode(CL3D.Scene.REDRAW_EVERY_FRAME);
if (scene)
{

var cam = new CL3D.CameraSceneNode();
cam.Pos.X = 100;
cam.Pos.Y = 100;
cam.Pos.Z = 100;

var animator = new CL3D.AnimatorCameraFPS(cam, engine);
animator.MoveSpeed = 0.2;
animator.RotateSpeed = 250;
animator.setLookByMouseDown(false);
cam.addAnimator(animator);

scene.getRootSceneNode().addChild(cam);
scene.setActiveCamera(cam);


engine.OnBeforeDrawAll = function()
{
var renderer = engine.getRenderer();
if (renderer)
{
var animator2 = new CL3D.AnimatorCameraFPS(cam, engine);
cam.setTarget(new CL3D.Vect3d(0,-10,0));
animator2.NoVerticalMovement = true;
cam.addAnimator(animator2);
}
};

var colanimator = new CL3D.AnimatorCollisionResponse(
new CL3D.Vect3d(20,40,20), // size of the player ellipsoid
new CL3D.Vect3d(0,0,0), // gravity direction
new CL3D.Vect3d(0,30,0), // position of the eye in the ellipsoid
scene.getCollisionGeometry());

cam.addAnimator(colanimator);
I am getting no error but its not working. The cam is tilted and NoVerticalMovement seems to work but the movement of the cam is very funny now. Also the cam (because of its target) is always faceing to the vector I defined.
I really need to do this. Can you see a possible solution when reading my script? I would appreciate any hint how to do this. Thx

person icon
ZK
Guest
Quote
2011-08-11 19:31:55

Maybe try setting the camera target as a set of absolute coordinates instead of setting it as a vector.

person icon
KK
Guest
Quote
2011-08-15 18:55:20

How? How to set them as a set of absolute coordinates? Its hard to find in the docs.. Btw I thought a vektor is explaining an exact position in 3d space. So what would be the difference to an absolute coordinate?!
emoji icon_happy
I am trying to do this - but using "NoVerticalMovement" seems to fail anyway. Niko is there any way to work around it? Otherwise I would like to request this ASAP.. I would send some paper once you could take care about this on a higher prio.. Shouldn´t take too much time I guess??

Thx heaps

person icon
ZK
Guest
Quote
2011-08-15 20:04:11

Sorry, I meant to say set the camera target as (0,0,0) instead of (new CL3D.Vect3D(0,0,0))

person icon
KK
Guest
Quote
2011-08-16 11:07:56

Thx ZK,

sorry I know the difference by now emoji icon_smile
Doing this appears to make more sense but it doesn´t solve the issue of not beeing able to freeze the cams vertical movement at its tilted position. I keep trying stuff but I would be most happy about any help.

Thanks

person icon
KK
Guest
Quote
2011-08-18 11:25:57

Does anyone got an idea how to do this? I will actually pay money on a working script..

person icon
niko
Moderator
Quote
2011-08-18 11:32:55

I send you a mail with a possible solution.

person icon
KK
Guest
Quote
2011-08-18 13:33:21

Yes I´ve just seen it and tried your script. It does indeed work very well! Thank you a lot! You should arrange a donation-button somewhere on your site :)

For anyone trying to accieve the same effect:
var engine = new CL3D.CopperLicht('3darea', true, 100, true);
engine.load('copperlichtdata/test.ccbjs');

engine.ingComplete = function()
{
var scene = engine.getScene();
if (scene)
{
var cam = scene.getActiveCamera();
anim = cam.getAnimatorOfType('camerafps');

anim.animateNode = function(n, timeMs)
{
CL3D.AnimatorCameraFPS.prototype.animateNode.call(this, n, timeMs);
var v = new CL3D.Vect3d(0,-0.5,0);
this.Camera.setTarget(this.Camera.Target.add(v)); // look downwards
};
}
}

Big Thanks.. And creditz to niko


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |