Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  New User with a Question
#1
Ok Im trying to develop a game and use obi cloth, I want to change avatar size during game play but this seems to be giving obi cloth fits.  Lets use underwear as an example when I adjust character size from 1.0 to .75 the underwear drops to thigh level and starts going through the character.  I have adjusted the blueprint of skinned cloth to work at size 1.0 but it doesnt seem to adjust after that.  Ive tried toggling the object off and on and for a split second the underwear is in place with the new size but then goes all wonky again.  Thanks in advanced.
Reply
#2
(25-10-2021, 04:20 PM)Fearinhell Wrote: Ok Im trying to develop a game and use obi cloth, I want to change avatar size during game play but this seems to be giving obi cloth fits.  Lets use underwear as an example when I adjust character size from 1.0 to .75 the underwear drops to thigh level and starts going through the character.  I have adjusted the blueprint of skinned cloth to work at size 1.0 but it doesnt seem to adjust after that.  Ive tried toggling the object off and on and for a split second the underwear is in place with the new size but then goes all wonky again.  Thanks in advanced.

Hi,

Deformable objects cannot be scaled at runtime. This affects cloth, ropes and softbodies, both in Obi and other engines as well.

The reason for this is that unlike a rigid object, a deformable object does not have a clear “center” to be scaled about, as it can freely deform. Same for rotation and translation, you can’t express the position/rotation/scale of a deformable object using a single transformation matrix.

That’s why the blueprint has a “scale” attribute: scale is baked into the cloth’s rest state.
Reply
#3
(25-10-2021, 04:39 PM)josemendez Wrote: Thanks for the reply, so what if I make copies of the clothing at different scales of the character?  I could do .95 .90 .85 etc and make blueprints at each size then run a script to change the blueprints accordingly?  



Hi,

Deformable objects cannot be scaled at runtime. This affects cloth, ropes and softbodies, both in Obi and other engines as well.

The reason for this is that unlike a rigid object, a deformable object does not have a clear “center” to be scaled about, as it can freely deform. Same for rotation and translation, you can’t express the position/rotation/scale of a deformable object using a single transformation matrix.

That’s why the blueprint has a “scale” attribute: scale is baked into the cloth’s rest state.
Reply
#4
Quote:Thanks for the reply, so what if I make copies of the clothing at different scales of the character?  I could do .95 .90 .85 etc and make blueprints at each size then run a script to change the blueprints accordingly? 

You could do that, it's very wasteful in terms of memory though. Also, you'll have to copy particle properties from the existing blueprint to the new one each time you change them. Generally, I'd advise against scaling deformable objects at runtime at all.
Reply
#5
(25-10-2021, 04:55 PM)Could you give an example of how to change the blueprint in the inspector window with script at runtime? josemendez Wrote: You could do that, it's very wasteful in terms of memory though. Also, you'll have to copy particle properties from the existing blueprint to the new one each time you change them. Generally, I'd advise against scaling deformable objects at runtime at all.
Reply
#6
It's very simple:

Code:
cloth.clothBlueprint = yourBlueprint;

Note this will reset all particle's positions and velocities to those contained in the blueprint, so for a smooth transition you will have to store particle data before changing the blueprint, and re-applying it after the blueprint's been changed. See:

http://obi.virtualmethodstudio.com/manua...icles.html
Reply
#7
Thank you!
Reply