hi,
i played around with the mecanim system, it realy rocks… ![]()
now, i looking for a example/technique how to use the mecanim system over the network. i have no idea how i convert the pos/rot updates in a movement. ![]()
And suggestions?
hi,
i played around with the mecanim system, it realy rocks… ![]()
now, i looking for a example/technique how to use the mecanim system over the network. i have no idea how i convert the pos/rot updates in a movement. ![]()
And suggestions?
Working on tweaking animations in mecanim and still not at the networking stage, but if it helps, my thought was to not send across pos/rot in realtime so much as to send the pos/rot + animation state. Then when the remote clients receive this message (presumably broadcasted via server), they set the appropriate pos/rot and kick off that state.
Alternately, perhaps you could use a hash map that mirrors the parameters map of your animation controller. Then if and only if a change occurs, stream across the value that has changed. In a script attached to each remotely animated object, do a lateupdate call to set each parameter value as needed.
Lots of issues here i’m sure, like synchronizing position when you’re relying on animation root control, but I think the answer lies in using traditional pos/rot synchronization + some means of persisting animation state changes over the network.
lots of theory
but thx, i will try several methodes…
Easiest solution? Don’t use root motion on proxies. I set up my proxy characters mecanim graph to use speed variables (calculated by tracking transform position change over time) to determine their states instead of input. This way, I could just sync position and rotation and mecanim will take care of the rest. like this:
private var velocity : Vector3;
private var localVelocity : Vector3;
private var lastPos : Vector3;
private var tr : Transform;
private var animator : Animator;
function FixedUpdate(){
velocity = (transform.position - lastPos)/Time.deltaTime;
localVelocity = tr.InverseTransformDirection(velocity);
lastPos = transform.position;
}
function Update(){
var speedZ : float = localVelocity.z/maxForwardSpeed;
if(localVelocity.z < 0) speedZ = localVelocity.z/maxBackwardsSpeed;
var speedX : float = localVelocity.x/maxSidewaysSpeed;
animator.SetFloat("SpeedZ", speedZ);
animator.SetFloat("SpeedX", speedX);
}
your solution looks nice ![]()
would you share your graph setup too?
Here is an example of how to network mecanim: http://forum.unity3d.com/threads/164650-Released-Mecanim-Network-Example
You can also have a look at this project which is a networked version of Will Goldstone’s MecanimTute project.
i have done my own system and it works well ![]()
Cool, how did you do it?
I have kept the one in the example project relatively simple, with the tradeoff that it could miss animation events on networked players. Their location and rotation should stay correct though. I basically network the position and rotation updates, as well as animator event variables. I would be interested in hearing other approaches.
I’m sick of seeing people seek help and then replying with “its OK I did it”!
The entire point of these forums are to get answers and then return the favor by GIVING BACK TO THE COMMUNITY
Says the guy with one post in total, which contains nothing but whine.
True thing, but basically he’s right. Since you got your solution and many other have the same problem, it would be good, if you share it to the rest of us.
I can understand, if you dont want to release important code for you game though