Multiplayer Rotation and Animation help

Is this to send the rotation via the multiplayer server? You seem to be sending the euler angles anyway via the server, I’m curious as to why you would want to do this?

Yeah i changed it trying to get it to work with Euler angle now but if you do know still please tell me.

@DevilZ do you know how to find the entity based on their data.id

I’m not entirely sure where you are assigning an “id” to a player. Is the ID just the unique name of the entity? Or does it denote something else?

According to the tutorial it is just a unique name

If it is indeed the name of an entity, you can get the associated entity by doing this.entity.findByName and searching by the ID. API Reference on findByName can be found here.

1 Like

Ok i got the name and put it in console and it works now I tried to update it but i tried to update it by using Euler angles but error

Uncaught TypeError: Cannot read property ‘setLocalEulerAngles’ of undefined

Network.prototype.movePlayer = function (data) {
    if (this.initialized && !this.players[data.id].deleted) {
        var OtherModel = this.app.root.findByName(data.id);
        console.log(OtherModel);
        this.players[data.id].entity.rigidbody.teleport(data.x, data.y, data.z);
        this.OtherModel.setLocalEulerAngles(0, data.rot, 0);              
    }
};

Everything works i just have to rotate or change Euler angles got any ideas.


I am pretty sure it is defined because it shows everything about it also it was two big to fit everything.
I know it is OtherModel is defined as well because when I change EulerAngles to rotate it works until you reach 360 degrees the instead of keeping on going it turns back around (i think this happens because rotate does not understand the number past 360).

My apologies about the previous post, I was not able to see a significant portion of the code on mobile. The reason it did not work was because OtherModel is a variable which contains the reference to an object, and is not an object itself. Therefore, you do not need to do this.OtherModel or this.app.OtherModel. You can just do OtherModel.setLocalEulerAngles(0, data.rot, 0);.

Ok I will try it. It works but it does the same as rotate

1 Like

Have you tried this on two different devices entirely? It might be because of a slight lag in the server. Glitch is not known to be the fastest solution.

I will try

1 Like

Nope does not work same problem

@Coder if I understand correctly, the issue is that you are not seeing a smooth rotation when another player rotates, and it’s only visible after a certain period of time, right? I don’t use glitch very often myself, it is rather slow in practise, so this might be because of that. If this is a major issue in your game, you might want to consider using a faster solution such as Photon.

Thanks for all your help I will try it out.

1 Like

Hi @DevilZ
I have connect to my Proton server but I have no idea how to send position an what not.

Please go through the README of the github repo I have sent you, it details all that. This topic will possibly be of assistance as well, as will the starter kit(do not fork this, use it for studying the structure of the project only).

1 Like

Ok @DevilZ I don’t understand

photon.raiseEvent(1, this.entity.getLocalPosition());
photon.raiseEvent(2, this.entity.getLocalPosition());

What is the different of the numbers do? I know they signify the Eventcode but what is that?

Don’t worry about It figured it out btw.

1 Like

Just to help others with the same problem who may consult this topic in the future, the event code is a unique identifier for every event sent.