Is it possible? I've already tried Thing_Move and Warp but it seems that both simply act like SetActorPosition, no interpolation whatsoever, I've also tried supplying the WARPF_INTERPOLATE flag for Warp and it did nothing, I'm I missing something?, Is there anyway to move the actor and make it appear as if the actor was moved to that location instead of "teleport" to it?
EDIT : does this ActorMover work on players ?
Moving actor "smoothly" to a specified location or TID.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
LOZ_98
- Posts: 67
- Joined: Thu Mar 22, 2018 7:46 pm
- Graphics Processor: nVidia (Modern GZDoom)
-
mty
- Posts: 46
- Joined: Thu Mar 29, 2018 1:48 pm
- Graphics Processor: nVidia with Vulkan support
- Location: EU
Re: Moving actor "smoothly" to a specified location or TID.
Prolly not the best solution, but this is how I solved this for a map of mine. I just started ACS a week ago, so I guess everything can be done better:
This moves a sky cam down a canyon giving the player the illusion of landing there with a spaceship.
It obviously sucks, that you have to calculate yourself how far it gets moved, etc.
You can see it in action here: https://www.youtube.com/watch?v=mzkO4uLRgD4
I have the feeling those interpolaton point actors might make a more elegant solution. But I didn't get how to use em yet.
Code: Select all
script 4 (void)
{
int x = 142606336;
x = x * (-1);
int y = 401932288;
int z = 52428800;
int FallingSpeed = 1;
int StartX = x;
int EndX = x + 304857600;
int TurningPoint = 152428800 +x;
int Acceleration = 655360;
Log(s:"LANDING");
while (x < EndX)
{
Acceleration = Acceleration - 550;
x = x + Acceleration;
if (x < Turningpoint)
{
Fallingspeed = Fallingspeed + 1;
}
else
{
Fallingspeed = Fallingspeed -1;
}
z = z - (FallingSpeed*650);
SetActorPosition(1000, x, y, z, 0);
delay(1);
}
}It obviously sucks, that you have to calculate yourself how far it gets moved, etc.
You can see it in action here: https://www.youtube.com/watch?v=mzkO4uLRgD4
I have the feeling those interpolaton point actors might make a more elegant solution. But I didn't get how to use em yet.
-
Arctangent
- Posts: 1235
- Joined: Thu Nov 06, 2014 1:53 pm
Re: Moving actor "smoothly" to a specified location or TID.
Well, here's the thing:
Movement in Doom, and every video game, really, is basically an illusion. As computer programs don't work in infinitely divisible units of time, movement in Doom is basically teleportation that occurs every 1/35th of a second.
Much like Thing_Move, Warp, and SetActorPosition is basically teleportation for a single 1/35th of a second.
So if you put these facts together, you'll find that the best way to handle this is to use a loop, such as a while loop, that iterates every tick and moves the actor up to x units in the direction of another. You'll want to brush up on your distance formula ( as if the targeted actor is closer than the speed per tick you're using, you can just skip a lot of the math and move the moved actor directly to the target ) and your trig ( specifically on how to use sine and cosine to create a vector in a non-cardinal direction, as you'll want to add that vector to the moved actor's current location so that, well, it actually moves towards its target ) to get this done.
Also, I should probably point out that WARPF_INTERPOLATE likely does do a bit of what you want, it's just that the movement is purely visual and it occurs within 1/35th of a second, so it's easy to miss if you aren't intentionally looking for it.
Movement in Doom, and every video game, really, is basically an illusion. As computer programs don't work in infinitely divisible units of time, movement in Doom is basically teleportation that occurs every 1/35th of a second.
Much like Thing_Move, Warp, and SetActorPosition is basically teleportation for a single 1/35th of a second.
So if you put these facts together, you'll find that the best way to handle this is to use a loop, such as a while loop, that iterates every tick and moves the actor up to x units in the direction of another. You'll want to brush up on your distance formula ( as if the targeted actor is closer than the speed per tick you're using, you can just skip a lot of the math and move the moved actor directly to the target ) and your trig ( specifically on how to use sine and cosine to create a vector in a non-cardinal direction, as you'll want to add that vector to the moved actor's current location so that, well, it actually moves towards its target ) to get this done.
Also, I should probably point out that WARPF_INTERPOLATE likely does do a bit of what you want, it's just that the movement is purely visual and it occurs within 1/35th of a second, so it's easy to miss if you aren't intentionally looking for it.
-
LOZ_98
- Posts: 67
- Joined: Thu Mar 22, 2018 7:46 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: Moving actor "smoothly" to a specified location or TID.
Thanks for the responses everyone 
@mty : ActorMover works best for your situation, but unfortunately it does not work on Players, I only got to test it recently and it's fairly easy to setup.
@Arctangent : I guess I'll have to go with that solution, It's a shame ActorMover doesn't work on players, If only Warp allowed us to modify interpolation data to make it look slower.
@mty : ActorMover works best for your situation, but unfortunately it does not work on Players, I only got to test it recently and it's fairly easy to setup.
@Arctangent : I guess I'll have to go with that solution, It's a shame ActorMover doesn't work on players, If only Warp allowed us to modify interpolation data to make it look slower.
-
mty
- Posts: 46
- Joined: Thu Mar 29, 2018 1:48 pm
- Graphics Processor: nVidia with Vulkan support
- Location: EU
Re: Moving actor "smoothly" to a specified location or TID.
Ah, you want to move the player.
I just wrote myself this for a thing to be moved to a destination TID:
If you set the first Arg to the player, the result is kinda funny, since it seems to apply gravity on me:
edit: The ticks should be a number that is a power of 2, I think.
edit2: Just an idea: couldn't you apply ActorMover on some dummy teleportation destiny and in a second script teleport the player to that teleportation destiny every tick? Sth like: "while (moving==1) {SetActorPosition(0, DummyTeleportx, DummyTeleporty, DummyTeleportz, 0); delay(1)}"?
I am gonna try that ActorMover now, thx for that
I just wrote myself this for a thing to be moved to a destination TID:
Code: Select all
script 4 (int ThingToMoveTID, int DestinationTID, int Ticks)
{
int DestinationX = GetActorX(DestinationTID);
int DestinationY = GetActorY(DestinationTID);
int DestinationZ = GetActorZ(DestinationTID);
int x = GetActorX(ThingToMoveTID);
int y = GetActorY(ThingToMoveTID);
int z = GetActorZ(ThingToMoveTID);
int SpeedX = (DestinationX - x)/Ticks;
int SpeedY = (DestinationY - y)/Ticks;
int SpeedZ = (DestinationZ - z)/Ticks;
for (int i = 1; i < Ticks; i++ )
{
x = x + SpeedX;
y = y + SpeedY;
z = z + SpeedZ;
SetActorPosition(ThingToMoveTID, x, y, z, 0);
delay(1);
}
}edit: The ticks should be a number that is a power of 2, I think.
edit2: Just an idea: couldn't you apply ActorMover on some dummy teleportation destiny and in a second script teleport the player to that teleportation destiny every tick? Sth like: "while (moving==1) {SetActorPosition(0, DummyTeleportx, DummyTeleporty, DummyTeleportz, 0); delay(1)}"?
I am gonna try that ActorMover now, thx for that
-
LOZ_98
- Posts: 67
- Joined: Thu Mar 22, 2018 7:46 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: Moving actor "smoothly" to a specified location or TID.
Wow, Thanks
your method seems much simpler than what I had in mind 
-
mty
- Posts: 46
- Joined: Thu Mar 29, 2018 1:48 pm
- Graphics Processor: nVidia with Vulkan support
- Location: EU
Re: Moving actor "smoothly" to a specified location or TID.
I like to KISS
Anyway, thanks for encouraging me to look at that ActorMover. I really enjoy scripting right now, so here is my solution:
I don't know any way how to get the octicks from the whole movement path, so you need to add that as an argument.
Still to improve:
Code: Select all
script 5 (int DummyTeleporterID, int ActorMoverID, int SumOfOcticks)
{
Thing_Activate(ActorMoverID);
int SumOfTicks = (SumOfOcticks * 35)/8+1;
int OldGravity = GetActorProperty(0, APROP_Gravity);
SetActorProperty(0, APROP_Gravity, 0);
for (int i; i < SumOfTicks; i++)
{
SetActorPosition(0, GetActorX(DummyTeleporterID), GetActorY(DummyTeleporterID), GetActorZ(DummyTeleporterID), 0);
delay(1);
}
SetActorProperty(0, APROP_Gravity, OldGravity);
}I don't know any way how to get the octicks from the whole movement path, so you need to add that as an argument.
Still to improve:
- If you are moving, when using the switch, it's still there when the player is released. At least that's what I think is happening.
- Set the first interpolation point's position to the player so the movement starts smoothly from wherever the player is using the switch. But there are only three arguments that I can pass?
-
mty
- Posts: 46
- Joined: Thu Mar 29, 2018 1:48 pm
- Graphics Processor: nVidia with Vulkan support
- Location: EU
Re: Moving actor "smoothly" to a specified location or TID.
edit: I will make an own topic out of the question that was here before.
Last edited by mty on Sun Apr 01, 2018 9:18 am, edited 1 time in total.
-
mty
- Posts: 46
- Joined: Thu Mar 29, 2018 1:48 pm
- Graphics Processor: nVidia with Vulkan support
- Location: EU
Re: Moving actor "smoothly" to a specified location or TID.
Sorry for spamming, but I really want to solve this, since I want to use it in my current campagne.
The ActorMover's APROP_Target seems to point at the beginning of the InterpolationPoints (so the second point). So I can always move it to wherever the player is. I reset it afterwards, since I ran in some trouble without doing that.
Now it's also possible to do sth like this:
But one has to be careful the player won't get stuck.
There's is an old topic, where someone asks the question how to get an actor's special and the corresponding args. Someone mentions user variables. Than he said thanks and marked it as solved. But I can't make anything out of that. GetUserVariable(ActorMoverID, "args[3]") always returns 0. I also tried "First TID", "low byte", but without succes.
This is the thread viewtopic.php?f=3&t=48881
I also can't find no way to disable the player's view bob for now.
The ActorMover's APROP_Target seems to point at the beginning of the InterpolationPoints (so the second point). So I can always move it to wherever the player is. I reset it afterwards, since I ran in some trouble without doing that.
Code: Select all
script 5 (int DummyTeleporterID, int ActorMoverID, int SumOfOcticks)
{
// Get the ActorMover's Target, which always seems to be the second
// interpolation point, now called StartActor
int StartActor = GetActorProperty(ActorMoverID, APROP_TargetTID);
// Storing the StartActor's initial values for the reset at the end
// of the script.
int OriginalStartX = GetActorX(StartActor);
int OriginalStartY = GetActorX(StartActor);
int OriginalStartZ = GetActorX(StartActor);
// Setting the StartActor to the player's coordinates, so the
// transition will be smooth
SetActorPosition(StartActor, GetActorX(0), GetActorY(0), GetActorZ(0), 0);
// Activate the ActorMover so the DummyTeleporter is beginning to move
Thing_Activate(ActorMoverID);
// Converting the Octicks to Ticks
int SumOfTicks = (SumOfOcticks * 35)/8+1;
// Storing the player's gravity, in case it was non-default
// And setting it to 0, so the player doesn't fall in between,
// because that looks like a glitch
int OldGravity = GetActorProperty(0, APROP_Gravity);
SetActorProperty(0, APROP_Gravity, 0);
// Since the dummy teleporter is beeing moved, the player is
// teleported to it every tick until the sum of ticks is reached
for (str i; i < SumOfTicks; i++)
{
SetActorPosition(0, GetActorX(DummyTeleporterID), GetActorY(DummyTeleporterID), GetActorZ(DummyTeleporterID), 0);
delay(1);
}
// Reseting the gravity & the StartActor as well as deactivating the
// ActorMover
SetActorProperty(0, APROP_Gravity, OldGravity);
Thing_Deactivate(ActorMoverID);
SetActorPosition(StartActor, OriginalStartX, OriginalStartY, OriginalStartZ, 0);
}Now it's also possible to do sth like this:
Code: Select all
script 6 enter
{
delay(200);
ACS_Execute(5, 0, 5, 4 ,100);
}There's is an old topic, where someone asks the question how to get an actor's special and the corresponding args. Someone mentions user variables. Than he said thanks and marked it as solved. But I can't make anything out of that. GetUserVariable(ActorMoverID, "args[3]") always returns 0. I also tried "First TID", "low byte", but without succes.
This is the thread viewtopic.php?f=3&t=48881
I also can't find no way to disable the player's view bob for now.
-
LOZ_98
- Posts: 67
- Joined: Thu Mar 22, 2018 7:46 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: Moving actor "smoothly" to a specified location or TID.
Supposedly one of the newest GZDoom versions added a way to modify or completely disable a player's viewbob using a new actor property, I don't know if it can be changed using SetActorProperty though.
EDIT : perhaps you could create a dummy actor with a different Player.Viewbob value and Morph your player to that actor when the script is executed and Unmorph once the sequence is finished.
EDIT : perhaps you could create a dummy actor with a different Player.Viewbob value and Morph your player to that actor when the script is executed and Unmorph once the sequence is finished.