Forcing an actor to "face" another via ACS?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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.

Forcing an actor to "face" another via ACS?

Postby Ravick » Sun Mar 18, 2018 1:18 am

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
Ravick
Do what thou wilt, since you don't bug the hell out of me!
 
Joined: 22 Aug 2010
Location: Tubarão, Brasil

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

Postby krokots » Sun Mar 18, 2018 5:18 am

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.
krokots
 
Joined: 19 Jan 2010

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

Postby Ravick » Mon Mar 19, 2018 10:03 pm

Thank you again, Krokots! :D
User avatar
Ravick
Do what thou wilt, since you don't bug the hell out of me!
 
Joined: 22 Aug 2010
Location: Tubarão, Brasil


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest