Announcement

Collapse
No announcement yet.

Movable Decals help.

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

    Movable Decals help.

    So I got somehow some movable decals but the thing is that I'd like to have decals moving instead of instancing them and detaching them all the time it's annoying though it looks good.

    Code here they are called in postbeginplay() function in some loops with timers ( You know what I mean ). I'd like to have a movable decal. Any idea on how to?

    //Here if the pawn is sleected it instances a decal.
    function SpawnAndDecalAndDestroyLater_TimerBased()
    {
    //SpawnedDecal.DetachFromAny();

    if(bSelected)
    {
    Self.AttachADecalOnFloorOfPawn( Self );
    }

    }

    //Here it gets detached.
    function ClearSpawnedDecalsFromFloor_TimerBased()
    {
    local int I;

    for( I = 0; I < SpawnedDecalsOfSelection.length; I++ )
    {
    SpawnedDecalsOfSelection[i].DetachFromAny();
    }

    }

    //Reads the selected group and attaches and decal on it
    function AttachADecalOnFloorOfPawn(GOTAMP2Pawn PawnWithDecal)
    {
    local Vector ActorRotationVector, ActorRotationVectorStart;
    local vector HitLoc, HitNor;
    local Rotator PlayerRotation;
    local DecalComponent SpawnedDecal;


    PlayerRotation=PawnWithDecal.Rotation;
    PlayerRotation.pitch=-16000;

    ActorRotationvectorStart.z=ActorRotationVectorStart.z+50;
    ActorRotationVectorStart=PawnWithDecal.location+vector(PawnWithDecal.Rotation);

    ActorRotationVector=vector(PlayerRotation);
    ActorRotationVector=ActorRotationVector*100;
    ActorRotationVector= ActorRotationVector+PawnWithDecal.Location;

    Trace(HitLoc,HitNor,ActorRotationVector,ActorRotationVectorStart);


    SpawnedDecal = WorldInfo.MyDecalManager.SpawnDecal( DecalMaterial'MPGOTA22DMats.DecalOfSelectionBox', // UMaterialInstance used for this decal.
    HitLoc, // Decal spawned at the hit location.
    rotator(-HitNor), // Orient decal into the surface.
    64, 64, // Decal size in tangent/binormal directions.
    256, // Decal size in normal direction.
    false, // If TRUE, use "NoClip" codepath.
    float(rotation.Yaw) / 1000, // random rotation
    );


    SpawnedDecal.bMovableDecal = true;
    SpawnedDecal.SetTranslation( HitLoc + vect( 1000, 0, 0 ) );
    SpawnedDecalsOfSelection.addItem( SpawnedDecal );

    //`log("FROM GOTAMP2Pawn spawning a cool decal");
    //SpawnedDecal.DetachFromAny();
    }

    Thanks in advance help appreciated.
    Some cool unreal projects you may like!


    Developer of GOTA - Survivalism Gladiatorial game Buy the game google gladiators of the arena steam https://store.steampowered.com/app/7..._Of_The_Arena/

    Download the demo Download the demo
    external link Dropbox DropBox

    Become a c++ Professional now C++ Networking Tutorial

    #2
    can you elaborate more? what really is the problem here? movable decals work just fine, I don't really get what you're doing here
    Follow me on Twitter!
    Developer of Elium - Prison Escape
    Localized IBL for UE4

    Comment


      #3
      https://www.dropbox.com/s/f4f0dkfa8i...SView.png?dl=0 So got em working but it's not so performance-friendly that is what I'm getting.
      Some cool unreal projects you may like!


      Developer of GOTA - Survivalism Gladiatorial game Buy the game google gladiators of the arena steam https://store.steampowered.com/app/7..._Of_The_Arena/

      Download the demo Download the demo
      external link Dropbox DropBox

      Become a c++ Professional now C++ Networking Tutorial

      Comment


        #4
        Also, please use code tags when posting code like this.

        Code:
        Like this

        Comment

        Working...
        X