Download

SetBase() doesn't seem to work for me

I’m currently trying to get one static mesh actor to attach to another, so that when the base move, the attached static mesh actor also moves.

Example:



StaticMesh2.SetBase(StaticMesh1);


Now when i change the location of StaticMesh1, i’d expect StaticMesh2 to move also. What am i missing here?

I’ve tried setting SetPhysics(PHYS_NONE) on the SMA that i’m attaching, but that also doesn’t help.

i think there’s a boolean called b hard attach or something that it’s responsable, setBase was in the documentation try to look for it.


if(SkelComp != none)
         {
          theactorhit.SetBase(MyVehicle);
          theactorhit.Sethardattach(true);
          theactorhit.SetOwner(MyVehicle);
         }

ive got the same problem.this does nothing.

I use this to attach items to the paws:

SetBase(Owner, Pawn0(Owner).Mesh, socket);

Call Sethardattach before SetBase or declare bHardAttach = True in attachment’s default properties. Here is my code for attaching and detaching pawn to another pawn’s socket. It’s from the base one.


function AttachPawn()
{
	Pawn.SetCollision(Pawn.default.bCollideActors, False);
	Pawn.bCollideWorld = False;
	Pawn.SetHardAttach(True);
	bCanBeBaseForPawns = True;
	Pawn.SetBase(self, , Mesh, AttachmentSocketName);
	Pawn.SetPhysics(PHYS_Flying);
}

function DetachPawn()
{
	Pawn.SetBase(None);
	if (Pawn.Physics == PHYS_Flying)
		Pawn.SetPhysics(PHYS_Falling);
	bCanBeBaseForPawns = False;
	Pawn.SetHardAttach(False);
	Pawn.SetCollision(Pawn.default.bCollideActors, Pawn.default.bBlockActors);
	Pawn.bCollideWorld = True;
}

Thanks for the responses. However it’s a just a static mesh actor that I want to move with another static mesh actor, not attacking one to a pawn.

Does anyone know why ActorToAttach.SetBase(ActorToAttachTo) doesn’t work?