Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
[BUG?] camera update latency with foreign behaviour

elmigo
Registered User
Quote
2018-12-27 05:26:48

i have behavior that get keys and move selected object
in my examle, selected object of behavior is active camera

if behavior attached to camera which selected then moving is smooth

if behavior attached to any other object then when behavior move camera then camera moving with shaking

if camera has child then when moving is child yet more laggy
for example, hand is break away with move to back

🔎︎



behavior_CursorMove.prototype.onAnimate = function(node, timeMs)
{

if (this.LastTime == null)
{
this.LastTime = timeMs;
return false;
}

var timeDiff = timeMs - this.LastTime;
this.LastTime = timeMs;
if (timeDiff > 200) timeDiff = 200;

var pos = ccbGetSceneNodeProperty(this.Object, 'Position');
var trg = ccbGetSceneNodeProperty(this.Object, 'Target');

var isMove = false;

if (this.keyUp) {isMove = true; this.calcDirFwd(pos, trg);}
else if (this.keyDown) {isMove = true; this.calcDirBack(pos, trg);}
if (this.keyLeft) {isMove = true; this.calcDirLeft(pos, trg);}
else if (this.keyRight) {isMove = true; this.calcDirRight(pos, trg);}

if (isMove)
{
var speed = this.Speed * timeDiff;
pos.x += this.dir.x * speed;
pos.y += this.dir.y * speed;
pos.z += this.dir.z * speed;

trg.x += this.dir.x * speed;
trg.y += this.dir.y * speed;
trg.z += this.dir.z * speed;
}

ccbSetSceneNodeProperty(this.Object, 'Target', trg);
ccbSetSceneNodeProperty(this.Object, 'Position', pos);


return true;
}



niko
Moderator
Quote
2019-01-14 14:42:29

Are you combining this with another behavior which also moves the camera? Like collision? Then it is a matter of which behavior comes first. If you can reverse the order the behaviors on the camera, maybe this already fixes it.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (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