- Home /
UNET Players are movable on collision
Hi guys,
On my multiplayer game, when a player enter in a collision on another player, he can move him. Do you know how to resolve this problem ? I'm trying to create a temporary debug with a boolean with OnCollision(Enter/Stay) and OnCollisionExit. It's the only way?
Best regards,
Answer by exowatt · Dec 14, 2015 at 04:40 PM
No, when a player enter in collision, he is moving the other player... I don't know how to solve this..!
I see , you don't want the other player to be displaced? You should use OnTriggerEnter ins$$anonymous$$d. If you want to use OnCollisionEnter but not moving the other player then you should have a check that when the player is in contact , the other player's velocity becomes 0. So it doesn't move as long as player is touching it. You must know how to code that , don't you?
Yeah, i know, I had not thought of that ! Thanks for your help ! :)
Answer by Haseeb_BSAA · Dec 14, 2015 at 02:29 PM
You want a method other than Collision check? Well , what I'll do in this is make a float variable 'distance'. Then equal that to Vector3.Distance(); and in parameters , put my player's position as point A and enemy's position as point B. Then I'll check that if distance <= 1f or so depending upon the models , and execute the debug.log statement on that. If distance > 1f , execute something else. Isn't it a good alternative? :)
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Synchronizing parented objects' position and rotation & handling player collision 0 Answers
Layer Collision in Networks (Mulitplayer Game). 0 Answers
Using SmartFoxServer extension to detect collisions? 2 Answers
Make objects collide only with other objects of same type 2 Answers