moving entities with vectors


(fretn) #1

I’m making an airplane for the airstrikes, I added two entities for radiant (startposition, and stopposition), the airplane has to fly between these two spots in a ‘parabole flight’…but I can’t let the plane fly from point a to point b … so I better forget the parabole flight.

I’m setting a dir vector to the stop-spot and then I move the plane with vectorMA to that stop spot by using the speed, and the dir vector. But It won’t work :sad:

the Airstrike_Gen is called by a cmd.

=============

void Airstrike_Gen( gentity_t *ent ) {
gentity_t *plane;
//vec3_t start, dir;

plane = G_Spawn();
plane->classname = “airstrikeplane”;
plane->nextthink = level.time + 10;
plane->think = Airstrike_Think;
plane->r.ownerNum = ent->s.number;
plane->parent = ent;
plane->s.eType = ET_AIRSTRIKE;

}

void Airstrike_Think( gentity_t *self ) {

/*

some code cut

stopSpot represents the ‘stopposition-entity’ that is placed in the map by radiant.

*/

VectorSet( dir, stopSpot->r.currentOrigin[0], stopSpot->r.currentOrigin[1], stopSpot->r.currentOrigin[2] );

speed = 50;

VectorMA(self->r.currentOrigin, speed, dir, self->r.currentOrigin);

trap_LinkEntity(self);

//Prepare for next move
self->nextthink = level.time + 10;

}

============

fretn ‘damn vectors :sad:’


(fretn) #2

ok, the problem was:

plane->r.svFlags = SVF_USE_CURRENT_ORIGIN | SVF_BROADCAST;
plane->s.pos.trType = TR_LINEAR;
plane->s.pos.trTime = level.time - 50;

after adding these my plane wants to move :smile:

<font size=-1>[ This Message was edited by: fretn on 2002-07-10 16:54 ]</font>


(digibob) #3

You may, or may not want to remove that - 50, what it does is project the object forward 50ms into it’s trajectory, this is done for the panzerfaust, buy may not look so good on a plane.


(fretn) #4

is it possible to make it turn when it’s flying ? Cause now it’s flying straight forward, but it should: appear under the skybox and dive and after a little dive (and bomb dropping), it should go up again and disappear above the skybox

or will this be very hard to code ?

fretn


(digibob) #5

Create a new parabolic trajectory type :smile: and no, it’s not too hard really :eek:


(fretn) #6

hmmm…I’ll take a look :smile:

Be sure I’ll come back :razz:

found a tutorial on adding trajectories…http://www.planetquake.com/code3arena/tutorials/tutorial38.shtml

is there somewhere a tutorial with good explanation on working with vectors … I understand the basics but not everything like setting a direction vector to move to a certain point in a map … ?

ok I inverted the TR_GRAVITY and it seems it’s doing what I want :smile:

what’s left:
1- stop spinning around own axis (easy, but haven’t found yet :grin: )
2- dropping bombs (easy)
3- let the plane fly in right direction (based on the points added in gtkradiant), if I leave it like now…it would like stupid, isn’t it ?

anyway thanks for the (help & advice) !

fretn


No man’s land
http://www.planetwolfenstein.com/nml

<font size=-1>[ This Message was edited by: fretn on 2002-07-10 23:12 ]</font>

<font size=-1>[ This Message was edited by: fretn on 2002-07-11 00:01 ]</font>


(Indloon) #7

I’m trying to make same thing as you did.Move plane from a point to b point.
(Wolfenstein:ET)
This is what I have done so far:


void AirstrikePlane( gentity_t *ent ) {
	vec3_t     planepos; //x, y ,z
    vec3_t     planedir;
    float      planespeed;
	
	planepos[0] = 0.0;
    planepos[1] = 0.0;
    planepos[2] = 70;

    planedir[0] = 0.707;
    planedir[1] = 0.0;
    planedir[2] = 0.707;

    planespeed = 100.0;

    planepos[0] += planespeed * planedir[0];
    planepos[1] += planespeed * planedir[1];
    planepos[2] += planespeed * planedir[2];
}

So basiclly it should move plane model from some point to point.
The question is how to I add the plane model to it and then to weapon_callAirStrike? :rolleyes:

I guess the plane parabolic trajectory could be like this:


(fretn) #8

The problem with RTCW was that there is a skybox which spoiled the eyecandy


(Indloon) #9

Well that explains that :<

However,I got the plane moving week ago,hired some pilots to be arty bosses.


(-SSF-Sage) #10

In what way does the skybox have to spoil the eye candy? It is possible to make very realistic sky and model your own scenery for your skybox. Look for avoc’s realistic skyboxes for the skybox, then look at escape1 for how to model the scenery for it. Biggest problem is that you might be limited to one model tho… That’s what I recall, not sure tho.


(fretn) #11

In some maps (in rtcw at least) the skybox is not place high enough so it looks like your plane comes out of the ceiling