Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Performance improvements for triggering emotes #5987

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ public class AvatarShape : MonoBehaviour, IHideAvatarAreaHandler, IPoolableObjec
private Service<IEmotesCatalogService> emotesCatalog;
private IAvatarEmotesController emotesController;
private AvatarSceneEmoteHandler sceneEmoteHandler;
private IBaseAvatarReferences baseAvatarReferences;
private readonly OnPointerEvent.Model viewProfilePointerModel = new ()
{
type = OnPointerDown.NAME,
button = WebInterface.ACTION_BUTTON.POINTER.ToString(),
hoverText = "View Profile",
};
public IAvatar internalAvatar => avatar;

private void Awake()
Expand All @@ -108,16 +115,15 @@ private void Awake()


//Ensure base avatar references
var baseAvatarReferences = baseAvatarContainer.GetComponentInChildren<IBaseAvatarReferences>() ?? Instantiate(baseAvatarReferencesPrefab, baseAvatarContainer);
baseAvatarReferences = baseAvatarContainer.GetComponentInChildren<IBaseAvatarReferences>() ?? Instantiate(baseAvatarReferencesPrefab, baseAvatarContainer);

avatar = avatarFactory.Ref.CreateAvatarWithHologram(avatarContainer, new BaseAvatar(baseAvatarReferences), animator, avatarLOD, visibility);

emotesController = avatar.GetEmotesController();

sceneEmoteHandler = new AvatarSceneEmoteHandler(
emotesController,
Environment.i.serviceLocator.Get<IEmotesService>(),
new UserProfileWebInterfaceBridge());
Environment.i.serviceLocator.Get<IEmotesService>());

avatarReporterController ??= new AvatarReporterController(Environment.i.world.state);

Expand Down Expand Up @@ -222,16 +228,11 @@ public async void ApplyModel(IParcelScene scene, IDCLEntity entity, PBAvatarShap
UpdatePlayerStatus(entity, model);

onPointerDown.Initialize(
new OnPointerEvent.Model()
{
type = OnPointerDown.NAME,
button = WebInterface.ACTION_BUTTON.POINTER.ToString(),
hoverText = "View Profile"
},
viewProfilePointerModel,
entity, player
);

outlineOnHover.Initialize(new OnPointerEvent.Model(), entity, player.avatar);
outlineOnHover.Initialize(entity, player.avatar);

avatarCollider.gameObject.SetActive(true);

Expand Down Expand Up @@ -342,7 +343,7 @@ internal void UpdatePlayerStatus(IDCLEntity entity, PBAvatarShape model)

float height = AvatarSystemUtils.AVATAR_Y_OFFSET + avatar.extents.y;

anchorPoints.Prepare(avatarContainer.transform, avatar.GetBones(), height);
anchorPoints.Prepare(avatarContainer.transform, baseAvatarReferences.Anchors, height);

player.playerName.SetIsTalking(model.Talking);
player.playerName.SetYOffset(Mathf.Max(MINIMUM_PLAYERNAME_HEIGHT, height));
Expand Down
Loading
Loading