Hi,
My wad is stupid, dumb and you shouldn't play it, period. To make it worse, I came up with this horrible idea. What I'd like to do is have a certain enemy force the player to look at them, zoom in, and play a sound while it's in their FOV. How could I do this?
[ACS] Force player to look at enemy?
Moderator: GZDoom Developers
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!)
Re: [ACS] Force player to look at enemy?
You may recover the yaw and pitch like so with the player as the activator. The last minus sign comes from view pitch being reversed from world pitch.
Code: Select all
int x_diff = GetActorX(target) - GetActorX(0);
int y_diff = GetActorY(target) - GetActorY(0);
int z_diff = GetActorZ(target) - GetActorZ(0); // looks good in general...
int facing_ang = VectorAngle(x_diff, y_diff);
int facing_vang = -VectorAngle(VectorLength(x_diff, y_diff), z_diff);
// alternative z_diff:
int view_target_z = GetActorZ(target) + GetActorProperty(target, APROP_HEIGHT) / 2;
int viewer_z = GetActorZ(0) + GetActorProperty(0, APROP_VIEWHEIGHT);
int z_diff = view_target_z - viewer_z;
// will make the activator face towards the target's centre.
Re: [ACS] Force player to look at enemy?
This is all acs?
- ramon.dexter
- Posts: 1562
- Joined: Tue Oct 20, 2015 12:50 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Kozolupy, Bohemia
Re: [ACS] Force player to look at enemy?
Looks like ACS to me.