Forum

Player Acceleration and Deceleration

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Player Acceleration and Deceleration

Postby Team Xlink » Fri Jan 08, 2010 11:35 pm

Hello.


I am trying to make an accelerating/decelerating thing for vehicles.


I have this in PlayerPostThink in Client.qc

Code: Select all
   if (self.weapon == IT_TEST) //Team Xlink - The TEST Vehicle
   {   
      if (self.velocity < 200 || self.velocity >= 170)
      {
         self.velocity = self.velocity * 1.1;
         self.testtimer = self.velocity + 1;
         self.nextthink = time + 1;
      }
   }


It sort of works.

You see, when you pickup that weapon ( Get into the vehicle) You automatically accelerate, but you never decelerate or even slow down, and it is always active.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Re: Player Acceleration and Deceleration

Postby c0burn » Fri Jan 08, 2010 11:47 pm

Team Xlink wrote:Hello.


I am trying to make an accelerating/decelerating thing for vehicles.


I have this in PlayerPostThink in Client.qc

Code: Select all
   if (self.weapon == IT_TEST) //Team Xlink - The TEST Vehicle
   {   
      if (self.velocity < 200 || self.velocity >= 170)
      {
         self.velocity = self.velocity * 1.1;
         self.testtimer = self.velocity + 1;
         self.nextthink = time + 1;
      }
   }


It sort of works.

You see, when you pickup that weapon ( Get into the vehicle) You automatically accelerate, but you never decelerate or even slow down, and it is always active.


It would probably help if you tell us what you want it to do. Also, is this for the PSP?
c0burn
 
Posts: 208
Joined: Fri Nov 05, 2004 12:48 pm
Location: Liverpool, England

Re: Player Acceleration and Deceleration

Postby Team Xlink » Fri Jan 08, 2010 11:49 pm

Team Xlink wrote:
I am trying to make an accelerating/decelerating thing for vehicles.



You see, when you pickup that weapon ( Get into the vehicle) You automatically accelerate, but you never decelerate or even slow down, and it is always active.


The first part is what to want to do the second part is the problem.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby c0burn » Fri Jan 08, 2010 11:59 pm

Why are you setting nextthink in playerpostthink?

You're also going to need to consider things like sv_maxspeed, cl_forward/back/side speed.

Some of it may need to be done engine side, but you can always check out qrally.
c0burn
 
Posts: 208
Joined: Fri Nov 05, 2004 12:48 pm
Location: Liverpool, England

Re: Player Acceleration and Deceleration

Postby Teiman » Sat Jan 09, 2010 5:31 pm


self.testtimer = self.velocity + 1;


is this adding a float to a vector ? looks wrong, but maybe is me
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest