I’m playing a LevelSequence from c++ but had a problem setting the starting position of a spawnable.
I want to play an animation that starts wherever the character is, but not to move with it, instead a camera with an offset starts following him
I’ve already set a possessable target, and even tried attaching an spawable to the character and it works (but this is not what I want), still I wasn’t able to set the initial location, these TemplateObject
s don’t have rootcomponent so you can’t set their transform.
Is it possible to set the initial transform of a sequencer spawnable?
this is what I’ve got:
// first set the HeroPlaceholder spawnable in the hero's location
int32 SpawnableCount = MovieScene->GetSpawnableCount();
for (int32 It = 0; It < SpawnableCount; It += 1)
{
FMovieSceneSpawnable Spawnable = MovieScene->GetSpawnable(It);
if (Spawnable.GetName().Contains("Hero"))
{
UObject* ObjectTemplate = Spawnable.GetObjectTemplate();
AActor* HeroPlaceholder = Cast<AActor>(ObjectTemplate);
// doesn't work
bool rootcomp = HeroPlaceholder->SetActorTransform(this->GetActorTransform());
HeroPlaceholder->SetActorRelativeTransform(this->GetActorTransform());
}
}
// then bind camera focus target to hero
int32 PossessableCount = MovieScene->GetPossessableCount();
for (int32 It = 0; It < PossessableCount; It += 1)
{
FMovieScenePossessable Possessable = MovieScene->GetPossessable(It);
if (Possessable.GetName().Contains("Focus"))
{
FGuid PossessableGuid = MovieScene->GetPossessable(It).GetGuid();
Sequence->BindPossessableObject(PossessableGuid, *this, this->GetWorld());
}
}
Alternatively, is there a way in the sequencer to make an object copy another object’s property? this way I could just set a possessable and copy the spawnable’s transform into the posessable object.