Hello,
I am learning AnyPortrait, which seems to be a very promising and powerful tool so far. Thank you as well for the amazing documentation.
I have however a few questions left if you don’t mind:
1) Is it possible to access and control the modifiers by script? More specifically, I would like to control the strength of a physics modifier by script.
2) I have read several pages of documentation and questions regarding changing the clothing of a character. However I have been experimenting with the following solution, which I think was not mentioned anywhere?
a) I create a character with no clothes. Give it animations, control parameters, etc.
b) I “Add image”: of a single piece of clothing, or an atlas of clothes.
c) I “Add Mesh” using the clothing image/atlas I’ve just added.
d) I add the new cloth mesh to my target Mesh Group meshes and use the clothing part like any other body part. I can now control it using control parameters, for example. It's as if it was part of the base character atlas.
Is it a valid approach? It will be a bit messy when I get 100 pieces of clothing in my Meshes list, but I don’t see any other downside. Do I miss something obvious?
3) Is there any guide, or do you have any indication on how to synchronize two AnyPortrait animations? For example, a character A hugs or handshakes with a character B. I couldn’t find information on this topic.
I see, thank you!
I'll experiment a bit further and see how it goes :)
Hi!
We will answer your questions one by one as follows.
1. You can control some of the properties of the modifier with a script, either directly or through control parameters, but unfortunately, the weights of the Physics modifier are not subject to this.
Instead, there is a function that activates/deactivates the entire physics effect.
Try using apPortrait's "SetPhysicEnabled(bool isPhysicEnabled)" function.
( https://rainyrizzle.github.io/en/Script/SC_Physics.html )
"Jiggle Bone", another function that represents physical effects, allows the weight to be controlled through "Control Parameters".
If your project can utilize Jiggle Bone (e.g. a side-scrolling action game), this may be more effective.
Please read the following manual.
https://rainyrizzle.github.io/en/AdvancedManual/AD_JiggleBone.html
2. We will respond to your suggestions on how to create “Character Clothes Replacement”.
What you're suggesting is putting all the wearable clothes on one character (even if they're different Atlases) and switching between them using Show/Hide.
That method is effective enough if the number of clothes is small.
This method is not bad in that you can change the clothes in advance in the AnyPortrait editor and create appropriate animations for the clothes.
However, this method has some disadvantages.
- Unnecessary memory load:
Clothing that is not shown remains loaded, so memory is used unnecessarily in-game and in the AnyPortrait editor.
- Performance issues:
Although AnyPortrait simplifies the handling of hidden objects, it still has to calculate whether those cloth meshes are "visible" in every frame. If the number of costumes increases, the game performance will slow down. This affects the performance of the AnyPortrait editor as well as in-game.
- Work efficiency:
Applying animation to all costumes is not an easy task. This is unavoidable if the clothes have different shapes, but it would be very cumbersome to perform similar tasks repeatedly for clothes of similar appearance. We recommend looking into ways to implement a large number of costumes or items while creating only the minimum essential animations.
3. “Synchronizing two characters” may have the following two meanings.
(1) Playing animations simultaneously:
This is the process of playing the same animations at the same time.
If you call the animation playback functions simultaneously, the animations will be almost perfectly synchronized.
If you want to synchronize on a frame-by-frame basis, use the Synchronize function.
( https://rainyrizzle.github.io/en/AdvancedManual/AD_SynchronizeWithOthers.html )
(2) Accurately matching the positions of the bones:
To perfectly match each other's positions, such as when shaking hands, the positions of the bones will need to be modified in real-time, unlike animation. The function used at this time is “IK”, and “IK Controller” is suitable for performing this role.
The "IK Controller" can be turned on or off as a control parameter, so you can enable "IK" during animation and synchronize the positions of bones by including some script.
To find the location of the bone through a script, you also need to know "Socket."
Please refer to the following manuals related to this content.
IK Controller : https://rainyrizzle.github.io/en/AdvancedManual/AD_BoneIKController.html
Socket : https://rainyrizzle.github.io/en/AdvancedManual/AD_Socket.html
Bone Script : https://rainyrizzle.github.io/en/Script/SC_Bone.html
If you have more questions about this issue, please leave a comment or create a new post!
Thank you.
P.S. The response may be slightly delayed due to the current main developer's health issue. Sorry.