Skip to content

Commit 77ed72a

Browse files
markatkMicky5991
authored andcommitted
Add position update guards and fix cam rotation
1 parent 869504a commit 77ed72a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

JustAnotherVoiceChat.Server.GTMP.Resource/Client/JustAnotherVoiceChat.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727

2828
let voiceHandler = null;
29-
let rotationThreshold = 0.1;
29+
let rotationThreshold = 0.001;
3030

3131
API.onResourceStart.connect(() => { voiceHandler = new GtmpVoiceHandler(); });
3232

@@ -87,7 +87,7 @@ class GtmpVoiceHandler {
8787
}
8888

8989
sendRotation() {
90-
const rotation = ((API.getGamePlayCamRot().Z * -1) * Math.PI) / 180;
90+
const rotation = ((API.getGameplayCamRot().Z * -1) * Math.PI) / 180;
9191

9292
if (Math.abs(this.lastRotation - rotation) < rotationThreshold) {
9393
return;

JustAnotherVoiceChat.Server/src/client.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ void Client::sendPositions() {
272272
}
273273

274274
void Client::setPosition(linalg::aliases::float3 position) {
275+
if (_position == position) {
276+
return;
277+
}
278+
275279
_position = position;
276280
_positionChanged = true;
277281
}
@@ -281,6 +285,10 @@ linalg::aliases::float3 Client::position() const {
281285
}
282286

283287
void Client::setRotation(float rotation) {
288+
if (_rotation == rotation) {
289+
return;
290+
}
291+
284292
_rotation = rotation;
285293
_positionChanged = true;
286294
}
@@ -298,6 +306,10 @@ bool Client::positionChanged() const {
298306
}
299307

300308
void Client::setVoiceRange(float range) {
309+
if (range == _voiceRange) {
310+
return;
311+
}
312+
301313
_voiceRange = range;
302314
_positionChanged = true;
303315
}

0 commit comments

Comments
 (0)