I just started learning Unity and SmartFox and the tutorials provided are extremely helpful. So thanks for that (can't wait for the SFS2X demo ).
However, I am now playing around with the Island demo and have replaced the frog character with a standard Unity model (the construction worker). For the local player it works fine (3rd person), but the remote player animations are not happening. I couldn't find anything in the tutorials on this, so maybe someone here can give some pointers on what I need to do to get the animations for the remote players to play? Currently the remote player floats and flickers or disappears when idle. I'm using Unity3.
Pointers on syncing animation?
Just figured it out. Originally the demo works with the FPS walker script. Because I switched to a 3rd person view with the corresponding script, the "Sendmessage" commands that are in the FPS walker scripts were no longer being fired. After adding these to the 3rd person script, for example SendMessage("PlayAnimation", "walk"); the animations are playing
I still have a problem that when the remote player is idle, the model flickers "on and off", so any suggestions for that are still welcome.
I still have a problem that when the remote player is idle, the model flickers "on and off", so any suggestions for that are still welcome.
I changed the "// ANIMATION sector" part in the script ThirdPersonController.js
I just added the SendMessage lines
I just added the SendMessage lines
Code: Select all
// ANIMATION sector
if(_animation) {
if(_characterState == CharacterState.Jumping)
{
SendMessage("PlayAnimation", "jump");
if(!jumpingReachedApex) {
_animation[jumpPoseAnimation.name].speed = jumpAnimationSpeed;
_animation[jumpPoseAnimation.name].wrapMode = WrapMode.ClampForever;
_animation.CrossFade(jumpPoseAnimation.name);
} else {
_animation[jumpPoseAnimation.name].speed = -landAnimationSpeed;
_animation[jumpPoseAnimation.name].wrapMode = WrapMode.ClampForever;
_animation.CrossFade(jumpPoseAnimation.name);
}
}
else
{
if(controller.velocity.sqrMagnitude < 0.1) {
_animation.CrossFade(idleAnimation.name);
SendMessage("PlayAnimation", "idle");
}
else
{
if(_characterState == CharacterState.Running) {
_animation[runAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, runMaxAnimationSpeed);
_animation.CrossFade(runAnimation.name);
}
else if(_characterState == CharacterState.Trotting) {
_animation[walkAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, trotMaxAnimationSpeed);
_animation.CrossFade(walkAnimation.name);
}
else if(_characterState == CharacterState.Walking) {
_animation[walkAnimation.name].speed = Mathf.Clamp(controller.velocity.magnitude, 0.0, walkMaxAnimationSpeed);
_animation.CrossFade(walkAnimation.name);
SendMessage("PlayAnimation", "walk");
}
}
}
}
// ANIMATION sector
Figured this one out now too. I had removed the FPS references and scripts a while back, thinking this was only used to show fps on the screen. But seems it is also used for the interpolation stuff. I put it back and the flickering is gone now.
Got something else now though: input from remote players is delayed. When the remote player moves around, the local client is still updating long after the remote player stopped moving. Also, as soon as the remote player stops moving (i.e. pressing a button), the walk animation in the local client stops, but the player object is still moving/floating around.
Got something else now though: input from remote players is delayed. When the remote player moves around, the local client is still updating long after the remote player stopped moving. Also, as soon as the remote player stops moving (i.e. pressing a button), the walk animation in the local client stops, but the player object is still moving/floating around.
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Units are moved with interpolation. This means that they are always lagging behind as an average of the last X transforms.
If you want super accurate movement of other players, you need to look into prediction and extrapolation.
Not that simple - so unless you are making a FPS, then you dont need these things. For most chat worlds and RPGMMO type things, interpolation is good enough.
If you want super accurate movement of other players, you need to look into prediction and extrapolation.
Not that simple - so unless you are making a FPS, then you dont need these things. For most chat worlds and RPGMMO type things, interpolation is good enough.
Thanks for the explanation. I don't need super accurate movement, but I still think something is wrong.
Ill try to explain. The longer the remote player moves, the longer it will take for the local client to update his position after he stops moving. For example, if the remote player would run 3 circles around the local player and then stops moving, the local player would only have seen him make one circle. The other two circles are then completed without walk animation and will continue for seconds after the remote player stopped.
I have never seen this with the island demo and the delay seems way to big to be normal. FYI, I have written down my first steps with Smartfox and Unity in thistutorial. I'll try to put an example online, but something crashes the webplayer.
Update: I think the crash is related to Unity3, because after compiling with Unity3, the Island demo crashes also (even with prefetching the socket policy).
Ill try to explain. The longer the remote player moves, the longer it will take for the local client to update his position after he stops moving. For example, if the remote player would run 3 circles around the local player and then stops moving, the local player would only have seen him make one circle. The other two circles are then completed without walk animation and will continue for seconds after the remote player stopped.
I have never seen this with the island demo and the delay seems way to big to be normal. FYI, I have written down my first steps with Smartfox and Unity in thistutorial. I'll try to put an example online, but something crashes the webplayer.
Update: I think the crash is related to Unity3, because after compiling with Unity3, the Island demo crashes also (even with prefetching the socket policy).
Return to “.Net / Unity3D API”
Who is online
Users browsing this forum: No registered users and 29 guests