|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
has anyone done this before? what i want to do is shoot a projectile in
an animation simply by setting a variable like shoot=true or something
like that. then, while it is true, i'd like a shot to be fired at
either steady or random intervals until set to false. each shot should
be its own entity. it should query the host object to know which
direction to move and from where it should start. then it should know
when it hits something and do something when it does. the projectile i
have in mind is a laser blast. would the particle patch help me here?
suggestions anyone?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"ryan constantine" <rco### [at] yahoocom> wrote in message
news:39AF5509.75964A45@yahoo.com...
| has anyone done this before? what i want to do is shoot a projectile in
| an animation simply by setting a variable like shoot=true or something
| like that. then, while it is true, i'd like a shot to be fired at
| either steady or random intervals until set to false. each shot should
| be its own entity. it should query the host object to know which
| direction to move and from where it should start. then it should know
| when it hits something and do something when it does. the projectile i
| have in mind is a laser blast. would the particle patch help me here?
| suggestions anyone?
Probably been tried at least. Sounds a bit like a mix of ranges and
detection; Greg Johnson or Rune Johansen, to name a couple of people, might
have a explanation for you.
I'd say you would use #switch and #range for the main timing and then a #if
conditional to see when a object vector is near the projectile, like
#if(ObjectAreaPosition*ProjectileAreaPosition<ContactDistance). Takes some
squaring of the area around each to know what space they occupy.
I would think trace() could do fine for this, especially because of the
non-spherical boundaries you would probably want to be using. But then
there's all the rest involved, such as moving the projectile in the proper
direction. Long story short, I have yet to do that myself.
Bob
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ryan constantine wrote:
> has anyone done this before? what i want to do is shoot a projectile in
> an animation simply by setting a variable like shoot=true or something
> like that. then, while it is true, i'd like a shot to be fired at
> either steady or random intervals until set to false. each shot should
> be its own entity. it should query the host object to know which
> direction to move and from where it should start. then it should know
> when it hits something and do something when it does. the projectile i
> have in mind is a laser blast. would the particle patch help me here?
> suggestions anyone?
I had been thinking of setting up my own missile defense animation and see
how hard it was!
I was about to give longer advice here , but I got confused by the concept
of a laser "querying its host object".
You can set up a system where you have eight variables defining your "flying
duck".
Position (3 variables xyz, affected by velocity)
Velocity (3 variables xyz, affected by gravity, willful acceleration)
DeadYet (0=alive; 1=dead)
TimeoDeath (Number of time frames SINCE I've been shot. )
#if(DeadYet>0.5)
#declare TimeoDeath=TimeoDeath+1;
#else
#if(vlength (Postion-Bulletposition)<ContactDistance) // ala Bob H
#declare DeadYet=1;
#end
#end
Then display duck, duck fragments, etc., based on above variables.
See:
http://www.geocities.com/pterandon/boids.html
Post a reply to this message
|
|
| |
| |
|
|
From: Bob Hughes
Subject: Re: animated projectiles shot while moving
Date: 1 Sep 2000 08:56:55
Message: <39afa797@news.povray.org>
|
|
|
| |
| |
|
|
"Greg M. Johnson" <gre### [at] my-dejanewscom> wrote in message
news:39AF9F93.4A990D21@my-dejanews.com...
| #if(vlength (Postion-Bulletposition)<ContactDistance) // ala Bob H
Hey, don't include me there :-)
Been trying to get a look at old Basic code I have here for some refresh of
the memory and only just now managed to get it out of binary form so I can
read it once again. It's no wonder I never made it in programming.
Bob
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
If your code snippet had been literally applicable, I would have written "as
per Bob H".
I'm so fluent (IMHO) at povray but barf extensively every time I pick up a C or
Java book that it's just a wonder why the original langs are so crappy.
Bob Hughes wrote:
> "Greg M. Johnson" <gre### [at] my-dejanewscom> wrote in message
> news:39AF9F93.4A990D21@my-dejanews.com...
> | #if(vlength (Postion-Bulletposition)<ContactDistance) // ala Bob H
>
> Hey, don't include me there :-)
> Been trying to get a look at old Basic code I have here for some refresh of
> the memory and only just now managed to get it out of binary form so I can
> read it once again. It's no wonder I never made it in programming.
>
> Bob
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
by "query the host object" i mean it can find the end of the muzzle as
well as the direction it is pointing in order to know which drection to
shoot. maybe the host (space ship) should set global variables
indicating where the muzzle tip is and the direction. then the laser
would just use the globals. what do you think?
"Greg M. Johnson" wrote:
>
> ryan constantine wrote:
>
> > has anyone done this before? what i want to do is shoot a projectile in
> > an animation simply by setting a variable like shoot=true or something
> > like that. then, while it is true, i'd like a shot to be fired at
> > either steady or random intervals until set to false. each shot should
> > be its own entity. it should query the host object to know which
> > direction to move and from where it should start. then it should know
> > when it hits something and do something when it does. the projectile i
> > have in mind is a laser blast. would the particle patch help me here?
> > suggestions anyone?
>
> I had been thinking of setting up my own missile defense animation and see
> how hard it was!
>
> I was about to give longer advice here , but I got confused by the concept
> of a laser "querying its host object".
>
> You can set up a system where you have eight variables defining your "flying
> duck".
>
> Position (3 variables xyz, affected by velocity)
> Velocity (3 variables xyz, affected by gravity, willful acceleration)
> DeadYet (0=alive; 1=dead)
> TimeoDeath (Number of time frames SINCE I've been shot. )
>
> #if(DeadYet>0.5)
> #declare TimeoDeath=TimeoDeath+1;
> #else
> #if(vlength (Postion-Bulletposition)<ContactDistance) // ala Bob H
> #declare DeadYet=1;
> #end
> #end
>
> Then display duck, duck fragments, etc., based on above variables.
>
> See:
>
> http://www.geocities.com/pterandon/boids.html
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
ryan constantine wrote:
> by "query the host object" i mean it can find the end of the muzzle as
> well as the direction it is pointing in order to know which drection to
> shoot. maybe the host (space ship) should set global variables
> indicating where the muzzle tip is and the direction. then the laser
> would just use the globals. what do you think?
Still confused.
EITHER
------------------------------------------------------------
// LASER BEAM: SPEED OF LIGHT
#declare laserhit=trace(Duck, LaserAim, LaserPosition, Norm);
#if( Norm.x!=0&Norm.y!=0&Norm.z!=0) //syntax may be a bit off
#declare DeadYet=1;
#end
---------------------------------------------------
// OR SHOOT A BUNCH OF BULLETS
#declare Bulletposition=Bulletposition+0.1*Bulletveloc;
#declare Bulletveloc=Bulletveloc-0.1*y;
#if(DeadYet>0.5)
#declare TimeoDeath=TimeoDeath+1;
#else
#if(vlength (DuckPostion-Bulletposition)<ContactDistance) // ala Greg
#declare DeadYet=1;
#end
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <39AF5509.75964A45@yahoo.com>, ryan constantine
<rco### [at] yahoocom> wrote:
> has anyone done this before? what i want to do is shoot a projectile in
> an animation simply by setting a variable like shoot=true or something
> like that. then, while it is true, i'd like a shot to be fired at
> either steady or random intervals until set to false. each shot should
> be its own entity. it should query the host object to know which
> direction to move and from where it should start. then it should know
> when it hits something and do something when it does. the projectile i
> have in mind is a laser blast. would the particle patch help me here?
> suggestions anyone?
The particle_system patch might help, though this particle system is
pretty easy to implement in POV-Script. I don't know if the ParticlePOV
patch will be of any use in this.
I have done something very similar to this in POV-Script while
stress-testing my #set patch, I will post an image in p.b.i soon. While
the source uses #set, it can easily be changed to use #local and
#declare(it will just hurt readability).
--
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
<><
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi. I'm new to this group, but I've been off in my own little cave working on
the problem of physics-based motion in povray for a little while now. At the
moment I'm working on a "frog" that points in a random direction and leaps
according to a random vector, then slides and when it gets slow enough jumps
again. Forgive me if I betray serious ignorance here, but in my
experimentation I haven't found any way to save persistent variables from one
frame to the next in povray without writing them out to a text file, so that's
what I'm doing. (code snippet below)
It seems like "querying the host object" is sort of backwards... wouldn't you
create the projectile object and give it position and move vectors based on
the known muzzle position and angle? If you don't know the muzzle position
and angle because the ship has moved and rotated, then you'd have to apply the
same transformations to the original muzzle coordinates that you applied to
the ship... does that make sense? (believe it or not, english actually is my
first language.)
#declare gravity_vector = <0,-8,0>;
#declare drag = 0.9;
#fopen FrogFile "frog.dat" read
#read (FrogFile,frog_position,frog_move,rot_y,rot_x)
#fclose FrogFile
#declare frog_move = (frog_move + gravity_vector) * drag;
#declare frog_position = frog_position + frog_move;
#fopen FrogFile "frog.dat" write
#write (FrogFile,frog_position,",",frog_move,",",rot_y,",",rot_x,",\n")
#fclose FrogFile
If anyone knows how I can save these variables without writing out to frog.dat
I'd be very happy!
"Greg M. Johnson" wrote:
> ryan constantine wrote:
>
> > by "query the host object" i mean it can find the end of the muzzle as
> > well as the direction it is pointing in order to know which drection to
> > shoot. maybe the host (space ship) should set global variables
> > indicating where the muzzle tip is and the direction. then the laser
> > would just use the globals. what do you think?
>
> Still confused.
>
> EITHER
> ------------------------------------------------------------
>
> // LASER BEAM: SPEED OF LIGHT
>
> #declare laserhit=trace(Duck, LaserAim, LaserPosition, Norm);
>
> #if( Norm.x!=0&Norm.y!=0&Norm.z!=0) //syntax may be a bit off
> #declare DeadYet=1;
> #end
>
> ---------------------------------------------------
>
> // OR SHOOT A BUNCH OF BULLETS
>
> #declare Bulletposition=Bulletposition+0.1*Bulletveloc;
> #declare Bulletveloc=Bulletveloc-0.1*y;
>
> #if(DeadYet>0.5)
> #declare TimeoDeath=TimeoDeath+1;
> #else
> #if(vlength (DuckPostion-Bulletposition)<ContactDistance) // ala Greg
> #declare DeadYet=1;
> #end
> #end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
|
|