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.
Neongho
(Neongho)
May 28, 2017, 12:06pm
2
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.
CobaltUDK
(CobaltUDK)
May 29, 2017, 12:10pm
4
I use this to attach items to the paws:
SetBase(Owner, Pawn0(Owner).Mesh, socket);
Avatarus
(Avatarus)
May 30, 2017, 5:10pm
5
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?