ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > CopperCube > Feature requests and bug reports
[BUG?] camera update latency with foreign behaviour
Author Text

Registered User
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;

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: "I?ternational" (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-2018 Nikolaus Gebhardt, Ambiera e.U.