Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  

projectile spiral & targeting system

Recommended Posts

I'm making ACS functions that deal with points in a fake "class" since there is no OOP.. will probably make a higher level sphere or box class etc, made of constituent fake point "objects".
Easier to just post separate wads, but they use a lot of the same functions/code (which is messy/changing):

Morphing projectile spiral
(tested/works in zdoom 2.5 & 2.6 (& probably earlier versions):


A targeting system
(only tested zdoom 2.6.x, probably works in earlier versions too)
Press spacebar to make the camera follow the next target. A simple example that could be given more bells and whistles or whatever, like having it target the closest enemy instead of sequentially (uses the new p_thingFace() function I made which makes a thing face a point object (can face pitch only, angle only, or both). Pitch only makes sense for cameras like the player view camera I think:
By the way, I think I found a zdoom bug: when you die, you kinda squash downward, but the GetActorViewHeight () keeps returning the height of a normal non-dead player (I could be wrong but probably not).
Actually, another possible bug: when I setactorpitch() to the player and make it 2.5 (facing straight down) in zdoom 2.6.1, it crashes. It also seems settable to values further from the supposed range mentioned on the zdoom wiki, like -2.4 to 2.4 seem to work fine in 2.6.1 (but that's good, so whatever). And -2.5 (straight up) didn't crash, just positive 2.5 (from what I remember).

Share this post

Link to post

I had a quick look at the ACS (literally a minute). And I have to ask: Is there any reason to use this over pathfollower things?

(This is a serious question, as I've considered doing my own path system.)

Share this post

Link to post

I've never used pathfollower things, like for moving a camera?

So far the points have functions to:
* rotate around an arbitrary axis (through the origin 0,0,0 or not)
* or rotate around x/y/z axis which is less computationally intensive if you only need that
* move toward/away from another point for given distance
* keep track of point indexes, so you can delete a point without problems
* obviously set position or get x/y or z
* just move some x/y/z amount

That's all really. I'm no coding expert and don't know very advanced math. I had to cheat and look up algorithms for stuff like an arbitrary axis rotation (a big hairy multi-step process of translating and rotating space, then untranslating/unrotating (I don't know "rotation matrixes" and don't want to learn them but I found some algorithm that doesn't need them apparently)).

This is really just a cacodemonball spiral art piece, kind of like a screen saver or something, disguised as some sort of altruistic "class" nobody else will want to use. So uh, just look at the pretty spiral instead or something. Right now I spawn a cacodemonball delay, and then delete it on every frame. But you could also move the same object instead of deleting/respawning for animation illusion.

It would probably be pretty good for making a camera follow a path while rotating and stuff (cameras have a pitch limited to some y-shearing values though). Did you have anything in particular in mind similar to that? Like what can't pathfollower things do that you want them to do?

Share this post

Link to post

Yeah, I meant pathfollowing things for moving camera. They do a lot of what you have implemented, although they don't implement rotate around axis or arbitrarily moving towards/away any point - it's a path follower, so it requires two points to make a path.

I'm working in GZDoom these days, so shearing doesn't concern me as much. You can pitch a camera any which way you want.

One thing I was thinking of doing my own pathfollowing for was for camera shots, actually. Rather than playing around with control points and timing, I wanted to write a pathfollower that would follow a path at a constant rate. It's perfectly achievable, but I didn't go ahead with it for one very good reason: ACS is locked to Doom's 35Hz update rate. ZDoom's built in pathfollowers interpolate camera positions as fast as your FPS allows. Or, put simply, since your monitor's refresh rate isn't a clean multiple of 35Hz, the camera will move in a jerky fashion.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this