POV-Ray : Newsgroups : povray.general : animated projectiles shot while moving : Re: animated projectiles shot while moving Server Time
9 Aug 2024 01:26:09 EDT (-0400)
  Re: animated projectiles shot while moving  
From: Rune
Date: 1 Sep 2000 16:39:42
Message: <39b0140e@news.povray.org>
"ryan constantine" wrote:
> has anyone done this before?

Yes! :-)

My never released Missile Bot game did that among many other things.

> the projectile i have in mind is a laser blast.

First of all, note that the method I use is useful only if the projectiles
move relatively slow (slow enough for the eye to see). Realistic gun shots
or laser blasts move far too fast.

> suggestions anyone?

The method I use is frame dependent. At the end of each frame I save data to
a file, and this data is then read in the next frame using #include. Maybe
you could use MegaPOV persistent variables instead, but I have never used
those myself.

I suggest you create 3 arrays that hold information about the projectiles.
One array holds projectile location vectors, one holds projectile direction
vectors, and one holds projectile status (a float).

The status could be:
0 = projectile not active,
1 = projective flying,
2-3 = projective exploding. (goes from 2 to 3 as the explosion evolves)

The three one-dimensional arrays must all have the same number of elements.
The number of elements should be the maximum possible number of simultaneous
projectiles.

In the first frame of the animation you fill the location array with <0,0,0>
in all the elements, similar with the direction array, and the status array
you fill with 0.

In the end of each frame you must write (in POV syntax) the 3 arrays into an
include file.
In the start of each frame (except the first) this include file is included.

At the time when you set Fire = on (or whatever), you pick an inactive
projectile and set it's location to the same location as your turret. The
projectile's direction is set to the direction the turret is pointing. The
status is set to 1.

Wait a minute, I'm not even halfway with the explanation - I can see that
this is too complicated for me to explain. Instead I will try to make you a
sample file that shows the technique. It may take a little while...

Greetings,

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated July 23)
/ Also visit http://www.povrayusers.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.