mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-26 03:39:00 +00:00
Updated CameraTracker.
This commit is contained in:
parent
e3440a2a06
commit
2fb6fd6bea
@ -547,7 +547,7 @@
|
|||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
210.53572189052173,
|
209.73151519075364,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -29,6 +29,15 @@ cc.Class({
|
|||||||
if (!selfPlayerRichInfo) return;
|
if (!selfPlayerRichInfo) return;
|
||||||
const selfPlayerNode = selfPlayerRichInfo.node;
|
const selfPlayerNode = selfPlayerRichInfo.node;
|
||||||
if (!selfPlayerNode) return;
|
if (!selfPlayerNode) return;
|
||||||
self.mapNode.setPosition(cc.v2().sub(selfPlayerNode.position));
|
const dst = cc.v2().sub(selfPlayerNode.position);
|
||||||
|
const pDiff = dst.sub(self.mapNode.position);
|
||||||
|
const stepLength = dt * self.speed;
|
||||||
|
if (stepLength > pDiff.mag()) {
|
||||||
|
self.mapNode.setPosition(dst);
|
||||||
|
} else {
|
||||||
|
pDiff.normalizeSelf();
|
||||||
|
const newMapPos = self.mapNode.position.add(pDiff.mul(dt * self.speed));
|
||||||
|
self.mapNode.setPosition(newMapPos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user