Results 1 to 16 of 16
  1. #1

    Default SkeletalMesh "Dissapears" at some angles

    hello again and as the title says im again having an issue with an KassetSpawnable


    I can spawn it fine with no issues but as soon i start moving or rotating it will dissapear at some angles as example if i rotate to my right the model will dissapear but then if i keep going until i rotated to my back the model will appear again in the perfect spot its like it just becomes invisible but keeps following the player rotation and movement

    So far this is what i got

    Code:
    class SV_Campfire extends KAssetSpawnable;
    
    
    var string BuildingName;
    var MaterialInstanceConstant matInst;
    var MaterialInstanceConstant MMat,RMat;
    var PhysicsAsset RPA,MPA;
    var bool bPlaceable,bReady,bSpawned;
    var int BuildPC;
    var SkeletalMesh MMesh,RMesh;
    
    
    
    
    function SetCollisionOff()
    {
           bCollideWorld = false;
          bBlockActors = false;
    
    }
    
    function SetCollisionOn()
    {
    bCollideWorld = true;
    bBlockActors = true;
    }
    
    function CheckLocation(vector NewLoc)
    {
    
    local Actor Actor;
    
    bPlaceable = true;
    SetPlaceable();
    
      ForEach VisibleCollidingActors(class'Actor', Actor, 2.0, NewLoc, true,, true)
          {
    	   SetUnPlaceable();
           bPlaceable = false;
            break;
          }
    	
    }
    
    
    
    function SetUnPlaceable()
    {
    matInst = new(None) Class'MaterialInstanceConstant';
     matInst.SetParent(MaterialInstanceConstant'SV_Buildings.Materials.Building_UnPlacebleMat_INST');
        //SkeletalMeshComponent.SetMaterial(0, matInst);
    
    
    
    }
    
    function SetPlaceable()
    {
    
    matInst = new(None) Class'MaterialInstanceConstant';
     matInst.SetParent(MaterialInstanceConstant'SV_Buildings.Materials.Building_PlacebleMat_INST');
       // SkeletalMeshComponent.SetMaterial(0, matInst);
    
    }
    
    function setDefaultMat(MaterialInstanceConstant Mat)
    {
    matInst = new(None) Class'MaterialInstanceConstant';
     matInst.SetParent(Mat);
        //SkeletalMeshComponent.SetMaterial(0, matInst);
    }
    
    simulated event TakeDamage (int DamageAmount, Controller EventInstigator, Object.Vector HitLocation, Object.Vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    {
    
    BuildPC = BuildPC + DamageAmount;
    
    
    if(BuildPC >= 50)
    {
    SetMeshAndPhysAsset(MMesh,MPA);
    MMat = new(None) Class'MaterialInstanceConstant';
     MMat.SetParent(MMat);
        //SkeletalMeshComponent.SetMaterial(0, MMat);
    
    }
    
    if(BuildPC >= 100)
    {
    SetMeshAndPhysAsset(RMesh,RPA);
    RMat = new(None) Class'MaterialInstanceConstant';
    RMat.SetParent(RMat);
        //SkeletalMeshComponent.SetMaterial(0, RMat);
    bReady = true;
    }
    
    }
    
    
    defaultproperties
    {
        Begin Object Name=KAssetSkelMeshComponent
            //SkeletalMesh=SkeletalMesh'phystest_resources.RemadePhysBarrel'
            Scale=1.0f
    		BlockRigidBody = true
        End Object
    	
    	BuildPC = 0
    
    
        bCollideWorld=true
        bHidden=false
    	BuildingName = "nopo"
        bCollideActors=true
    
        //bWakeOnLevelStart=true
        bDamageAppliesImpulse=true
    }
    to spawn the kasset

    Code:
    if(Building.bIsCampfire == true)
    				
    				{
    				     Pawn.Mesh.GetSocketWorldLocationAndRotation(BuildSocketStart, StartLoc);
    		        EndLoc = vector(Pawn.Rotation) * 100+ StartLoc;
                    Trace(HitLocation, HitNormal, StartLoc, EndLoc,true,,, //TraceHitActor = 
                    TRACEFLAG_Bullet);
    				
                    
    				 PA = PhysicsAsset(DynamicLoadObject(Building.campfirePA, class'PhysicsAsset'));
    				  RPA = PhysicsAsset(DynamicLoadObject(Building.campfireRPA, class'PhysicsAsset'));
    				  MPA = PhysicsAsset(DynamicLoadObject(Building.campfireMPA, class'PhysicsAsset'));
    				  
    				  Mesh2 = SkeletalMesh(DynamicLoadObject(Building.campfireModel, class'SkeletalMesh'));
    
    				HalfMesh = SkeletalMesh(DynamicLoadObject(Building.campfireMModel, class'SkeletalMesh'));
    				ReadyMesh = SkeletalMesh(DynamicLoadObject(Building.campfireRModel, class'SkeletalMesh'));
                     CampfireToSpawn = Spawn(class'SV_Campfire', self,, EndLoc); //pawn.location
    
                    bIsBuilding = true;
                    bCanBuild = true;
                    tfpPawn(Pawn).bSpawnedBuilding = false;
                    
                    CampfireToSpawn.SetMeshAndPhysAsset(Mesh2,PA);
       
    				 CampfireToSpawn.MMesh = HalfMesh;
    				 CampfireToSpawn.RMesh = ReadyMesh;
    				 CampfireToSpawn.RPA = RPA;
    				 CampfireToSpawn.MPA = MPA;
    
    		       
    			     CampfireToSpawn.BuildingName = Building.buildingName;
                    Mat = MaterialInstanceConstant(DynamicLoadObject(Building.campfireMat, class'MaterialInstanceConstant'));
    				HalfMat = MaterialInstanceConstant(DynamicLoadObject(Building.CampfireMMat, class'MaterialInstanceConstant'));
    				ReadyMat = MaterialInstanceConstant(DynamicLoadObject(Building.CampfireRMat, class'MaterialInstanceConstant'));
    		         CampfireToSpawn.MMat = HalfMat;
    			     CampfireToSpawn.RMat = ReadyMat;
    				// CampfireToSpawn.SetPhysics(PHYS_Flying); // if i try to change its physics it stops following the player movement
    				
    			
    				}

    and to update the position

    Code:
    function UpdateBuildPosition()
    {
        local Vector BuildPos,dir;
    
    
    P = tfpPawn(Pawn);
        
    
            dir = Vector(Pawn.Rotation);
    
    		  BuildPos = tfpPawn(Pawn).GetPawnViewLocation() + dir  * BDDistance * PerDistance; 
            BuildPos.Z = BuildPos.Z - 75;
    
         
    		  
    		  
    		  
    		  if(CampfireToSpawn.bPlaceable == true)
              {
              CampfireToSpawn.SetLocation(BuildPos);
              CampfireToSpawn.CheckLocation(BuildPos);
              CampfireToSpawn.SetCollisionOff();
    
              }
              
              if(P.bSpawnedBuilding == true)
              {
               bIsBuilding = false; 
               bCanBuild = true;
               CampfireToSpawn.setDefaultMat(Mat);
    		   CampfireToSpawn.SetCollisionOn();
    		    HUDClass.CloseBDUI();
    
              }
              
        
              
              if(CampfireToSpawn.bPlaceable == false)
              {
              CampfireToSpawn.SetLocation(BuildPos);
              CampfireToSpawn.CheckLocation(BuildPos);
              CampfireToSpawn.SetCollision(false,false,false);
              }
    		  
    		  
    		  
              
        }
    }
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  2. #2

    Default

    Ok so it seems that the mesh keeps following the player rotation and movement becouse i tried logging its location and whatever its visible or not it seems to print the location fine... Now i wonder why it suddenly becomes invisible
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  3. #3
    MSgt. Shooter Person
    Join Date
    Mar 2011
    Location
    Brisbane Australia
    Posts
    274

    Default

    Could it be a lighting environment issue? have you tried adding a light Environment component?

  4. #4

    Default

    Im almost sure the KAsset class alredy has it

    heres a video showing the issue

    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  5. #5
    Boomshot
    Join Date
    Aug 2011
    Posts
    2,285

    Default

    That looks like a possible culling issue: the engine isn't rendering the object because its bounds are outside the view.

    I tried reading through your code but as soon as I saw multiple physics assets loaded dynamically I gave up and made a cup of tea There are a couple of ideas you could investigate to solve this.

    1
    The bounding box of the physics asset may be different to the visible mesh. Or it could be offset. Try tilting the view up and down.

    2
    All though the mesh appears to move with the pawn it's possible the asset is stationary where it was spawned. You could place a debug draw at the spawn point and check if the mesh disappears when that point leaves the view.

    These are just guesses. It's tricky to know what's really going on because the concept is a 'campfire' while the visual is a 'stick', and then there's a lot of indirection from dynamically loaded assets.

  6. #6

    Default

    Well ill explain a bit the campfire

    basicly since the campfire can be "Upgraded" basicly once certain actions the campfire changes its model and phys asset Thats why i load all tree of them from the Ini file(using sapitu and dynamicloadobject) and then i store all this references in the class instance

    So for my building system i made a few changes so it supports an skeletal mesh so i can create a few bones and attach an particle system to smiulate the fire and finally an mesh that will represent the wood

    also about the second option i tough it was completly dissapearing once it leaved the view but i tried loging its location and it seems that whatever it was Visible or not it would still print the location forward or back whatever i started to move
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  7. #7

    Default

    Ok so its definitly an problem with the skeletal mesh i even tried using an kactorspawnable sub class to see if it was the KassetSpawnable class being an issue so Or either UDK For some reason doesnt render the mesh at some angles and thats why i cant see it Or well i cant think of anything more that could cause it

    Also why does this happends with an skeletal mesh? i tried using an static mesh instead and it would render fine
    Last edited by alvarofer0021; 03-31-2012 at 08:54 PM.
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  8. #8
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Quote Originally Posted by alvarofer0021 View Post
    ...
    i tried using an static mesh instead and it would render fine
    Because SM has PHYS_None, you should disable physics and collision in KActor when attached...

  9. #9
    Redeemer
    Join Date
    Jul 2011
    Location
    London, UK
    Posts
    1,749

    Default

    if you are right vendorx then i was right you are the best

  10. #10
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    @yahooanswers: I'm afraid, without full code this will be lucky guess...
    How are you?

  11. #11
    Boomshot
    Join Date
    Aug 2011
    Posts
    2,285

    Default

    I've reproduced similar behaviour in the editor by borking the bounds of the skeletal mesh. Use the show bounds console command and test your problem again, you should find the mesh vanishes when the box/sphere bounds leave the view.

  12. #12

    Default

    So any tips to handle the mesh bounds?
    Last edited by alvarofer0021; 04-01-2012 at 02:29 PM.
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  13. #13

    Default

    Bumping the post
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  14. #14
    Iron Guard
    Join Date
    Jan 2009
    Posts
    743

    Default

    Theres a bounds multiplier param in the skelmesh properties iirc. Increase it. But since bounds are taken from the physasset, and noone knows what physasset you're using, ymmv
    Last edited by Jetfire; 04-02-2012 at 08:51 AM.

  15. #15

    Default

    Oh well i tried checking arround the phys asset and the skeletal mesh bounds scaling them etc but whatever i do it seems that they just stay in the same spot whatever the Mesh is spawned rather than following it
    Last edited by alvarofer0021; 04-02-2012 at 10:13 AM.
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282

  16. #16

    Default

    once again Bump
    Rising Soul Studios Main Leader
    S.U.R.V.I.V.O.R RPG Survival Game

    http://www.moddb.com/games/survivor
    http://forums.epicgames.com/showthread.php?t=819282


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.