What is wrong with this line of code?

Does anyone know whats wrong with this line of code

   if (this.initialized && !this.players[data.id].deleted) {
        this.players[data.id].entity.rigidbody.teleport(data.x, data.y, data.z);

(picture for context)
(its in rotate player)

What error/issue are you getting?

Hey @yaustar my issue is instead of making the other player rotate that code is making theme faze in and out of existence.

Chances are that data.r is NaN or undefined in your rotatePlayer code

Hey @yaustar now I have a new issue. I fixed a small error in the server code and now it just makes the other player disappear and never come back.

the error was data.r was being sent to player moved not player rotated

here is both my network code and my server code in case you want to take a look

instead of listening to a whole new event why dont you do it in position udpate.


It’s doing the same thing.

You cant use this.players[data.id].entity.setRotation on a rigidbody instead add extra parameters to the teleport, it should be: this.players[data.id].entity.rigidbody.teleport(data.x, data.y, data.z,0,data.r,0);.

it did the same thing the other player appeared for a second then disappeared.

do you think it may be something in the editor?

Here is the link if you want to take a look

if it appeared and disappeared it must mean that data.r is undefined, try debugging what data your receiving.

1 Like

how do i do that?
all i know how to do with the debug console is console.log

Yep: console.log(data)

Hey @Fus_ion Now it works but only for the first 180 degrees if you go farther than that then it turns around

Sorry i was away but let me take a look at your code again

I cant seem to find a solution to the rotation problem.

Please don’t create multiple threads about the same issue @WilliamBoersma31