Forcing an actor to "face" another via ACS?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

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!)
Post Reply
User avatar
Ravick
Posts: 2002
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil
Contact:

Forcing an actor to "face" another via ACS?

Post by Ravick »

Hi there,

I'd like to make an actor "face" anotehr one(s) via ACS. I mean, It'd be just like DECORATE's "A_FaceTarget", but not restricted to actor's target; I'd like to force an actor to face any TID'ed actor as I wish. How could I do that?

Thanks in advance! :)
User avatar
krokots
Posts: 266
Joined: Tue Jan 19, 2010 5:07 pm

Re: Forcing an actor to "face" another via ACS?

Post by krokots »

You can use SetActorAngle.
First, calculate the angle between actor A and B from positions. I think it is atan2(B.Y - A.Y , B.X - A.X). Convert that to fixed angle (check Definitions.
User avatar
Ravick
Posts: 2002
Joined: Sun Aug 22, 2010 10:59 pm
Location: Tubarão, Brasil
Contact:

Re: Forcing an actor to "face" another via ACS?

Post by Ravick »

Thank you again, Krokots! :D
Post Reply

Return to “Scripting”