if “I’m a character” and “I’m immovable” -> I become a wall
if “I’m a character” and “I have to move” -> I become a character
move=talk=interact…
The last video that you posted shows player-vs-npc interaction. If npc interaction is what you’re after then set the npc’s rigidbody.mass = 0.0f. However, if you want the npc to move about then set its mass to thousands of magnitude higher than the player’s, as to not allow npcs to be moved by the player.
If you’re actually looking for a player-vs-player interaction and don’t want the player to be moved by another player, take a look at 18_CharacterDemo, the void Character::HandleNodeCollision(StringHash eventType, VariantMap& eventData) fn., this block:
the contactImpulse is commented out, but that tells you the impulse which was applied to the other body. Check whether the otherbody is a player and store that impulse and apply that on the next frame in FixedUpdate. Apply on the next frame because the collision callback indicates that the physics cycle has completed and will do nothing if you apply it in that function.
edit: err, I hope you understand that when I say store and apply the impulse, that I mean negate/reverse the impulse which was applied. I might be mistaken about applyImpulse in collisionHandler. I know applying force and torque from that function gets thrown out, but impulse might stick.
Hmm ya, I understand it. I was thinking about my character movement, and ApplyImpulse its the best way to do what I want? Because I was checking this repository:
And I guess that I needed something custom like this… 'll try another solution different than ApplyImpulse.
Here we go. My solution for now was: on client side Im using character kinematic controller, while all anothers units on server side uses normal rigidbody with Kinematic seted on true.
I don’t know if this way will works on anothers projects, because I rewrote somethings of Scene Replication and Network system to fulfill what I want on a MMORPG (example: the replication of character position, in the video Im with simulated latency on 300ms, if I used the Urho3D way, it would be a problem).