Hi there,
I'm using Opsive Third Person Controller for my upcoming game. I do not however want to use the asset available for multiplayer as it's not quite what I need. I did purchase it, but I would rather build my own system.
Having that said, I'm struggling here. I don't understand how I'm supposed to move my npc characters.
In my update method, I have the following:
This is how a keyframe is sent across the network.
...Now this is the very minimum, to perhaps get something my working. My keyframe buffer works amazingly, as I've used it for other projects. The problem here though is that I'm not really sure how opsive handles movement. The problem I'm experiencing is that when I change the position and rotation, the animations will reset, basically be spammed, restarting over and over.
I also don't know what I should be pulling my position from, as you can see I'm using localPosition, but I doubt this is what I should be using -- I'm using it because the rigidbody position and normal position had really crazy results.
Ultimately, I just need to know how to properly get the rotation, the position, and velocity if possible, and of course how to set all of these.
Thanks!
I'm using Opsive Third Person Controller for my upcoming game. I do not however want to use the asset available for multiplayer as it's not quite what I need. I did purchase it, but I would rather build my own system.
Having that said, I'm struggling here. I don't understand how I'm supposed to move my npc characters.
In my update method, I have the following:
Code:
KinematicObjectManager.SetCharacterMovementInput(characterLocomotion.KinematicObjectIndex, _lastInputFrame.HorizontalInput, _lastInputFrame.VerticalInput);
if (syncBuffer.HasKeyframes)
{
syncBuffer.UpdatePlayback(Time.deltaTime);
KinematicObjectManager.SetCharacterPosition(characterLocomotion.KinematicObjectIndex, syncBuffer.Position);
KinematicObjectManager.SetCharacterRotation(characterLocomotion.KinematicObjectIndex, syncBuffer.Rotation);
}
This is how a keyframe is sent across the network.
Code:
public void SendSyncMessage()
{
var rotation = transform.localRotation;
var position = transform.localPosition;
_lastSentRotation = rotation;
_lastSentPosition = position;
_timeSinceLastSync = 0f;
ClientManager.Instance.SendSyncUpdate(_timeSinceLastSync, position, rotation);
}
...Now this is the very minimum, to perhaps get something my working. My keyframe buffer works amazingly, as I've used it for other projects. The problem here though is that I'm not really sure how opsive handles movement. The problem I'm experiencing is that when I change the position and rotation, the animations will reset, basically be spammed, restarting over and over.
I also don't know what I should be pulling my position from, as you can see I'm using localPosition, but I doubt this is what I should be using -- I'm using it because the rigidbody position and normal position had really crazy results.
Ultimately, I just need to know how to properly get the rotation, the position, and velocity if possible, and of course how to set all of these.
Thanks!