What happened to actor.setbase()?

Anyone are to share what happened to the set base function or what it got turned into to, trying to keep my character in place while on a moving platform , any ideas?

Hi Brad,

ACharacter has a SetBase function, if you’re looking to be able to walk around on your platform while it moves.

If you just want a firm attachment to the base, Rama’s suggestion to use AttachRootComponentToActor() is a good one.

Cheers!
Jeff

I agree with Jeff, but I can’t understand why this code is not running automatically for you Brad

What are you basing your Character on?

Static Mesh Actors that are set to mobility moveable will base any characters correctly for you,

you should try to use them if you can :slight_smile:

Rama

Im using the blueprint actor, Im using Rama’s suggestion though, i’ll try it again and see what happens but so far as I can tell it didn’t set the base

#In Actor.h

You can set an actor to base on another actor’s specific component,

or set an actor to set base on another actor’s root component

The result is you can simply tell one actor to base on another in terms of the info you must provide in code :slight_smile:

/** 
	 *  Attaches the RootComponent of this Actor to the supplied component, optionally at a named socket. It is not valid to call this on components that are not Registered. 
	 *   @param AttachLocationType	Type of attachment, AbsoluteWorld to keep its world position, RelativeOffset to keep the object's relative offset and SnapTo to snap to the new parent.
	 */
	UFUNCTION(BlueprintCallable, meta=(FriendlyName = "AttachActorToComponent", AttachLocationType="KeepRelativeOffset"), Category="Transform|Actor")
	void AttachRootComponentTo(class USceneComponent* InParent, FName InSocketName = NAME_None, EAttachLocation::Type AttachLocationType = EAttachLocation::KeepRelativeOffset);

	/**
	 * Attaches the RootComponent of this Actor to the RootComponent of the supplied actor, optionally at a named socket.
	 * @param InParentActor				Actor to attach this actor's RootComponent to
	 * @param InSocketName				Socket name to attach to, if any
	 * @param AttachLocationType	Type of attachment, AbsoluteWorld to keep its world position, RelativeOffset to keep the object's relative offset and SnapTo to snap to the new parent.
	 */
	UFUNCTION(BlueprintCallable, meta=(FriendlyName = "AttachActorToActor", AttachLocationType="KeepRelativeOffset"), Category="Transform|Actor")
	void AttachRootComponentToActor(AActor* InParentActor, FName InSocketName = NAME_None, EAttachLocation::Type AttachLocationType = EAttachLocation::KeepRelativeOffset);

#The Enum

To use these functions you need this enum list in your mind:

UENUM()
namespace EAttachLocation
{
	enum Type
	{
		KeepRelativeOffset,
		KeepWorldPosition,
		SnapToTarget
	};
}

#Relevant Example Usage: Attach to Moving Platform

Attach actor to another actor, keep the actor’s previous world location at the time of attachment (but then moving actor with other actor from that point onward)

YourPlayerCharacter->AttachRootComponentToActor(ThePlatform,NAME_None,EAttachLocation::KeepWorldPosition);