Announcement

Collapse
No announcement yet.

Skeletal Mesh morph node parameter modification.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Skeletal Mesh morph node parameter modification.

    Hi. I have a skeletal mesh in my level with morph. I've set up an animtree and matinee sequences for it. Set up morph node weight. It's working.... from kismet. So I, let's say, can play morph 0>1 value once the player triggered certain volume or pressed the key.... But the issue is that I need to set the dependence between player's...let's say... X coordinate and morph node value, so bigger is "x" -> bigger is morph weight, so the morphing can go smoothly depend of player's movement.
    So I've found this code:
    "
    Code:
    simulated function FindMorphNode()
    {
        EarRightMorphNode == MorphNodeWeight(Mesh.FindMorphNode('EarRight'));
       if(EarRightMorphNode == none)
        {
        }
        EarRightMorphNode.SetNodeWeight(1.0f);
    
        EarLeftMorphNode == MorphNodeWeight(Mesh.FindMorphNode('EarLeft'));
       if(EarLeftMorphNode == none)
        {
        }
        EarLeftMorphNode.SetNodeWeight(1.0f);
    }
    "
    - I suppose it works within certain class that you use, with it's "object", so to, let's say to modify player's mesh, I should create extended player controller class? And to modify "environmental" SkeletalMeshMAT mesh within the scene should I create extended "skeletal mesh" class with this function, or I can find and modify certain mesh's parameter in scene? And what should I use, something like "foreach AllActors" iterator:
    "
    Code:
    class TestIteration extends UTGame;
    
    var UTWeaponPickupFactory SpecialFactory;
    
    function StartMatch()
    {
        local UTWeaponPickupFactory factory;
       
        Super.StartMatch();
       
        foreach DynamicActors( class'UTWeaponPickupFactory', factory )
        {
           
          if( factory.tag == 'SPECIAL_FACTORY' ) 
          {
            SpecialFactory = factory;
            break;     // Ends the search
          }
        }
        
        Broadcast( self, " Object Name =" @ SpecialFactory.name) ;    
    }
    "
    ...but it used only with subclasses.
    Or wrap a kismet function somehow, where I can specify certain skeletal mesh and "MorphNode" value for it...

    Please, I need your expirience and asking for your help. Help me to solve my problem please.

    P.S.:sry for my english.

    #2
    Trying to do something like:
    "
    Code:
    class SimpleActor02 extends Actor
       placeable;
       
       var MorphNodeWeight WeightNode;
    
    simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
    {
      Super.PostInitAnimTree(SkelComp);
    
      if (SkelComp == SkelComp2)
      {
        WeightNode = MorphNodeWeight(SkelComp2.FindMorphNode('entertest_control'));
        if(WeightNode != None)
        {
            WeightNode.SetNodeWeight(1);
        }
      }
    }
    
    defaultproperties
    {
       Begin Object class=SkeletalMeshComponent Name=SkelComp2
        SkeletalMesh=SkeletalMesh'Diploma.SkeletalMesh.entertest'
        AnimTreeTemplate=AnimTree'Diploma.SkeletalMesh.entertest_Animtree'
        MorphSets(0)=MorphTargetSet'Diploma.entertest_MorphTargetSet'
        End Object
        Mesh=SkelComp2
        Components.Add(SkelComp2)
       }
    "

    The compiler didn't like "if (SkelComp == SkelComp2)" line, tells me about bad or missing expression after "==", but I have not idea what is the right way to implement what I need.

    Comment


      #3
      Modified code again.... half-way there so far:

      Code:
      class SimpleActor02 extends Actor
         placeable;
            
         var MorphNodeWeight WeightNode;
      
      simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
      {
        Super.PostInitAnimTree(SkelComp);
      
        if (SkelComp.SkeletalMesh == SkeletalMesh'Diploma.SkeletalMesh.entertest')
        {
          WeightNode = MorphNodeWeight(SkelComp.FindMorphNode('entertest_control'));
          if(WeightNode != None)
          {
              WeightNode.SetNodeWeight(1);
          }
        }
      }
      
      defaultproperties
      {
             
         Begin Object class=SkeletalMeshComponent Name=SkelComp2
          SkeletalMesh=SkeletalMesh'Diploma.SkeletalMesh.entertest'
          AnimTreeTemplate=AnimTree'Diploma.SkeletalMesh.entertest_Animtree'
          MorphSets(0)=MorphTargetSet'Diploma.entertest_MorphTargetSet'
          End Object
          Components.Add(SkelComp2)
          }
      Now let's see for the controls over "WeightNode" instead of constant.
      and... Lighting of the model looks awful, how can I fix it?

      Comment


        #4
        Just added dependence from player's coordinates. It's all working.
        THE LAST QUESTION:
        how to turn back on dynamic lighting on the model?
        Tried
        Code:
        bCastDynamicShadow = True
            //bAcceptsDynamicDominantLightShadows = True
            bAcceptsLights = True
            bAcceptsDynamicLights = True
        and so on, but actor is looking rather different from it's SkeletalMeshMAT copy. Why?

        Comment


          #5
          Nothings perfect

          Comment


            #6
            You'll need to create a DynamicLightEnvironmentComponent for your mesh to get the lighting to look right since it's a skeletal mesh (if you haven't already). Something like this in your DefaultProperties should work:

            Code:
            Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
            	bSynthesizeSHLight=TRUE
            	bUseBooleanEnvironmentShadowing=FALSE
            End Object
            Components.Add(MyLightEnvironment)
            Then make the mesh use it by adding LightEnvironment=MyLightEnvironment to the mesh component's declaration. bSynthesizeSHLight can be slow if you're using it on a bunch of objects, so if this is an actor you'll be using a lot, set it to false. Take a look here for more info.

            Comment

            Working...
            X