get "pointer" direction of movement

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
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

get "pointer" direction of movement

Post by Apeirogon »

How any actor can get direction of movement of other actor?
I want projectile shoting monsters start shooting ahead of a moving target so that the target and projectile will collide. Because mighty cyberdemon with high-tech implant, which cant hit with rockets one bald monkey looks pathetic.
User avatar
krokots
Posts: 296
Joined: Tue Jan 19, 2010 5:07 pm

Re: get "pointer" direction of movement

Post by krokots »

Predicting shots, eh? Just get actor vel. Vel is Vector3.

Code: Select all

Vector3 targetMovement = Target.Vel;
Monsters do not use velocity though (only players and projectiles). It would be useless against monsters anyway - their movement is too random. But if you REALLY want to do this with monsters, you'd need to get their direction from "movedir" (see actor.txt in gzdoom.pk3). Monsters move only in 8 directions, so you'd have to calculate this from this and their speed (the speed property). I don't know how, but it would be possible.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: get "pointer" direction of movement

Post by Apeirogon »

I make monsters that "move" in full 3D space, but I dont know how make it truly MOVE in 3D space, because I use set origin with interpolations and 3D vectors that point to monster target, with lenght equal to it, monster, speed. Now I have caco which makes loops and kulbit using math black magic.

So, how make monster which truly move in full 3D? I try make so using thrust thing (z) and pythagoras, but I dont know how pick correct slope direction from vector, since dont know how gzdoom computing it.
Post Reply

Return to “Scripting”