Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Node move & camera behaviour

warner
Registered User
Quote
2012-01-03 01:01:01

This method override makes the camera behave like a regular object, so it doesn't stay focused at the same point when it moves:

CL3D.CameraSceneNode.prototype.calculateViewMatrix = function () {
this.getAbsoluteTransformation().getInverse(this.ViewMatrix);
this.recalculateViewArea()
};


This adds a 'move' method to SceneNodes, so you can more easily move in the direction it is facing:

CL3D.SceneNode.prototype.move = function(x, y, z) {
var aim = new CL3D.Vect3d();
aim.X = x;
aim.Y = y;
aim.Z = z;
this.getRelativeTransformation().rotateVect( aim );
this.Pos.X += aim.X;
this.Pos.Y += aim.Y;
this.Pos.Z += aim.Z;
}



niko
Moderator
Quote
2012-01-03 07:32:46

that's why I like JavaScript. Easy to add useful stuff to other classes. :)


warner
Registered User
Quote
2012-01-03 12:44:01

Thanks, Niko. Indeed, very easy, but also due to how CopperLicht is set up: I am amazed how fast it runs, and how flexible it is.


Create reply:


Posted by: (you are not logged in)


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


Text:

 

  

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


   






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