# direct.distributed.DistributedSmoothNode¶

from direct.distributed.DistributedSmoothNode import DistributedSmoothNode, globalActivateSmoothing


DistributedSmoothNode module: contains the DistributedSmoothNode class

Inheritance diagram

class DistributedSmoothNode(cr)[source]

This specializes DistributedNode to add functionality to smooth motion over time, via the SmoothMover C++ object defined in DIRECT.

__init__(self, cr)[source]
activateSmoothing(self, smoothing, prediction)[source]

Enables or disables the smoothing of other avatars’ motion. This used to be a global flag, but now it is specific to each avatar instance. However, see globalActivateSmoothing() in this module.

If smoothing is off, no kind of smoothing will be performed, regardless of the setting of prediction.

This is not necessarily predictive smoothing; if predictive smoothing is off, avatars will be lagged by a certain factor to achieve smooth motion. Otherwise, if predictive smoothing is on, avatars will be drawn as nearly as possible in their current position, by extrapolating from old position reports.

This assumes you have a client repository that knows its localAvatarDoId – stored in self.cr.localAvatarDoId

clearSmoothing(self, bogus=None)[source]
d_returnResync(self, avId, timestampB, serverTime, uncertainty)[source]
d_setParent(self, parentToken)[source]
d_suggestResync(self, avId, timestampA, timestampB, serverTime, uncertainty)[source]
delete(self)[source]
disable(self)[source]
doSmoothTask(self, task)[source]
forceToTruePosition(self)[source]

This forces the node to reposition itself to its latest known position. This may result in a pop as the node skips the last of its lerp points.

generate(self)[source]
getComponentH(self)[source]
getComponentL(self)[source]
getComponentP(self)[source]
getComponentR(self)[source]
getComponentT(self)[source]
getComponentX(self)[source]
getComponentY(self)[source]
getComponentZ(self)[source]
getSmoothWrtReparents(self)[source]
peerToPeerResync(self, avId, timestamp, serverTime, uncertainty)[source]
reloadPosition(self)[source]

This function re-reads the position from the node itself and clears any old position reports for the node. This should be used whenever show code bangs on the node position and expects it to stick.

returnResync(self, avId, timestampB, serverTimeSec, serverTimeUSec, uncertainty)[source]

A reply sent by a client whom we recently sent suggestResync to, this reports the client’s new delta information so we can adjust our clock as well.

setComponentH(self, h)[source]
setComponentL(self, l)[source]
setComponentP(self, p)[source]
setComponentR(self, r)[source]
setComponentT(self, timestamp)[source]
setComponentTLive(self, timestamp)[source]
setComponentX(self, x)[source]
setComponentY(self, y)[source]
setComponentZ(self, z)[source]
setSmH(self, h, timestamp=None)[source]
setSmHpr(self, h, p, r, timestamp=None)[source]
setSmPos(self, x, y, z, timestamp=None)[source]
setSmPosHpr(self, x, y, z, h, p, r, timestamp=None)[source]
setSmPosHprL(self, l, x, y, z, h, p, r, timestamp=None)[source]
setSmStop(self, timestamp=None)[source]
setSmXY(self, x, y, timestamp=None)[source]
setSmXYH(self, x, y, h, timestamp)[source]
setSmXYZH(self, x, y, z, h, timestamp=None)[source]
setSmXZ(self, x, z, timestamp=None)[source]
setSmZ(self, z, timestamp=None)[source]
setSmoothWrtReparents(self, flag)[source]
smoothPosition(self)[source]

This function updates the position of the node to its computed smoothed position. This may be overridden by a derived class to specialize the behavior.

startSmooth(self)[source]

This function starts the task that ensures the node is positioned correctly every frame. However, while the task is running, you won’t be able to lerp the node or directly position it.

stopSmooth(self)[source]

This function stops the task spawned by startSmooth(), and allows show code to move the node around directly.

suggestResync(self, avId, timestampA, timestampB, serverTimeSec, serverTimeUSec, uncertainty)[source]

This message is sent from one client to another when the other client receives a timestamp from this client that is so far out of date as to suggest that one or both clients needs to resynchronize their clock information.

wantsSmoothing(self)[source]
wrtReparentTo(self, parent)[source]
globalActivateSmoothing(smoothing, prediction)[source]

Globally activates or deactivates smoothing and prediction on all DistributedSmoothNodes currently in existence, or yet to be generated.