Jump to content

Home

Some info on tr stuff


Commodus

Recommended Posts

--------------------------------------------------------------------------------

There are 2 problems here. You never set the TR type, so it's defaulting to TR_STATIONARY. This means client side prediction (and lerping) is not performed. Basically you have a stationary object that keeps moving! You should probably make it TR_LINEAR (since I doubt it speeds up or slows down as it's traveling). The second problem is, like you said, you aren't setting trTime. That's not a huge problem right now because it's stationary, so trTime is ignored, but it will be used when you change it to TR_LINEAR.

 

Quick background on the tr stuff:

>trBase needs to be set to the 'base' ie, the start position of the object, or the last known 'valid' position.

>trTime needs to be set to the level time in which the trBase was set. That means every time you update trBase, you need to set trTime=level.time

>trDelta specifies basically how fast the object is moving, and the direction it's moving in. The way it works is it multiplies trDelta by the difference between trTime and the current time, then adds it to the base. So for example, if trTime is 4 and level.time is 10, then it multiplies trDelta by 6 and adds it to trBase.

>trType specifies the type of moving object this is.

>trDuration specifies how long the object moves. This is mostly just used for doors that move a bit, then stop. For most other things, you can set it to 0.

 

You can actually add your own trTypes. I had to add TR_BALL for QPong to look even halfway decent.

 

--------------------

 

This stuff was written by BinaryC on the Raven Software Mod Makers forum, so if you find it does help you, credit him. (wudan this might be something useful to include in the Dark side compendium...)

 

Also, does anybody know why there are several different variables for a player's origin (like ent->s.pos.trBase and ent->r.currentOrigin)? I've noticed that currentOrigin is copied to trBase in the end of the rocket think code, and you need it to have that line if you want the missile to interpolate properly (and not be a pain in the ass).

Link to comment
Share on other sites

The r is for entityShared_t inside gentity_s. It seems to used for 'moving things along'.

 

trBase appears to have info on where it will be next server frame, as this info gets gets copied, added and copied back in to the currentOrigin. This info on the objects current location is most likely sent to the client with gamestate packets ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...