protected virtual Skeleton ConnectAvatar(SharedWorld world, Scene scene) { Skeleton skeleton = null; Scene displayScene = world.GetScene(); try { if (currentAvatar.IsActive) { return(currentAvatar.BodyPoser); } if (currentAvatar.IsHavokFile) { skeleton = currentAvatar.ConnectBody(physics); } else { skeleton = currentAvatar.ConnectBody(scene.Engines); skeleton.Remove(false); physics.Append(skeleton); } world.Observe(Event.LOAD_SCENE, skeleton); if (skeleton != null) { if (scriptor != null) { scriptor.Directory = config.mediadir; scriptor.Target = currentAvatar.AnimSkeleton; if (!currentAvatar.AnimSkeleton.Name.Contains("amy")) { currentAvatar.AnimSkeleton.GetBone(0).SetOptions(Transformer.RELATIVE); } if (config.script != null) { scriptor.LoadScript(config.script); } currentAvatar.IsActive = true; if (config.animation != null) { dynamic animinfo = config.animation; if (animinfo.scale != null) { string s = animinfo.scale; double d = Double.Parse(s); if (d > 0) { Scriptor.SetAnimationScale((float)d); } } } } } else { return(null); } } catch (Exception) { // do nothing for now } return(skeleton); }