Page 1 of 1

avatar skin sharing issue

Posted: 24 Oct 2008, 01:27
by morgflast
I defined a custom avatar class that inherits from IAvatarMovieClip, and made sure to override its function called skin, that returns an object that describes a skin. However, when I add additional avatars to the room, none of them seem to be seeing the skins of the others.

I know that when an avatar's skin changes, all the other avatars are aware of that change. However, when a user enters a room, how is it supposed to find out the skins of the avatars that are already there?


Thanks

Posted: 24 Oct 2008, 06:15
by Bax
The proper way to set the skin of an avatar is by passing the proper "skin" object (which can contain strings, numbers, booleans, arrays or nested objects, but not visual classes or custom classes!) to the OpenSpace.createMyAvatar method (for the initial skin) and eventually changing it later with the OpenSpace.setMyAvatarSkin method. The skin object is then passed to the AvatarMovieClip by means of the IAvatarMovieClip.onSkinChange listener.

Behind the scenes, OpenSpace saves the "skin" object in the user variables, so it is shared among all the users in a room. When your avatar is created on my client, for example, OpenSpace retrieves your skin data from your user variables and passes it to the avatar which is being rendered.

Posted: 13 Nov 2008, 10:10
by thg
Behind the scenes, OpenSpace saves the "skin" object in the user variables, so it is shared among all the users in a room. When your avatar is created on my client, for example, OpenSpace retrieves your skin data from your user variables and passes it to the avatar which is being rendered.
How does my client know how to use the skin data for rendering your avatar?
Suppose I put a variable called "frame" inside the skin data. Can I use this value to go to frame-something in the trousers_mc of your avatar when rendering your avatar on my client when I enter the room? How would I do that?

Thanks

Posted: 17 Nov 2008, 09:17
by Bax
thg wrote:How does my client know how to use the skin data for rendering your avatar?
All avatars are instances of the same AvatarMovieClip class, so when you code that class, you have to consider that it used to render your avatar on your client, but also you avatar on other clients.
If your skin data contains a "frame" parameter, you just have to use that information to go to the right frame, independently from the "owner" of that avatar and the client on which it is rendered.