Hi, I was wondering if there was a method I could call that would enable me to lock an actor in place or if I need to do it from scratch. I tried using the bLockLocation bool but with no luck, does anyone know how to do it?
Thanks,
Hi, I was wondering if there was a method I could call that would enable me to lock an actor in place or if I need to do it from scratch. I tried using the bLockLocation bool but with no luck, does anyone know how to do it?
Thanks,
What is your intention here?
For example, you can mark the Actor as Statc in Editor.
Or by Script (pseudocode!):
bool isMoveable;
Vector3 StaticLocation;
…
OnTick()
{
if isMoveable==false
{
if ActorLocation != StaticLocation
{
Actor.Location = StaticLocation
}
}
}
What I want to do is basically whenever this actor overlaps a trigger box, the actor will stay in the same position it was in when it first overlapped the trigger box
An actor doesn’t actually move by itself at all! Instead, actors are moved by other objects, either something like direct action from the game or a Controller (which is a bit of a hack,) or through some kind of MovementComponent (which is the preferred/better way.)
There are many things that can move an actor.
It may be simulating physics, in which case you need to turn off physics simulation.
It may be using a CharacterMovementComponent, in which case you need to tell that controller to freeze the character.
It may be using some other MovementComponent (projectile, vehicle, …)
It may be being animated by a level sequence.
Each of those need a different mechanism to “freeze” the actor, because they each move the actor in a different way. So, for your gameplay need, you can either make each of the movement methods that matter to you, know about this kind of freezing trigger, OR you can make your freezing triger, know about each movement method, and configure it appropriately.
Thank you very much, I forgot that “SetSimulatePhysics(false)” existed. The actor now stays in the location and doesn’t move anymore.