Client side TraceRay issue

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
Posts: 7
Joined: 2012-03-16, 06:07

Client side TraceRay issue

Post by JimMarlowe » 2012-05-07, 04:19

I have a problem with the client side TraceRay() in existing weapons ClientSide_HandlePrimaryFireEvent() methods, they do not return the same information as the TraceRay in the ServerSide_Think(). I do see it work very very intermittently. I began wondering why when I fire at a CompanyBot, it appears to miss and show the miss particle on the wall. Since the CompanyBot can take damage, I'm assuming it should also be able to be hit on the client side. If that is wrong, I'll stop doing that... Do I need to kick the PhysicsWorld or something?

I'v recorded the TraceRay() inputs and outputs from a clean cw_357.cpp:

Server player ID[15] heading[46846] pitch[4020]
Server RayResult Hit entity 61,

Client player ID[15] heading[46846] pitch[4020]
Client RayResult Hit entity 0,

rfw = RayResultT.m_rayFromWorld
rtw = RayResultT.m_rayToWorld;
hnw = RayResultT.m_hitNormalWorld;
hpw = RayResultT.m_hitPointWorld;
User avatar
Site Admin
Posts: 2169
Joined: 2004-08-19, 13:46
Location: Germany

Re: Client side TraceRay issue

Post by Carsten » 2012-05-08, 10:45

Hi Jim,

thanks for your report! I can reproduce this here:

Using r531, when I set convar sv_AutoAddCompanyBot = true, start map Kidney and pick up the 9mm AR, then when I fire at the company bot, it clearly is hit and receives damage at the server side, but it is not hit at the client: the particle effect is shown at the nearby wall instead.
(In a contrast, the crate near the starting point seems to work as expected: it's hit by bullets and the particle effect is red.)

This seems to be a problem with updating the physics world on the client side, but unfortunately I've not been able to figure out its cause yet.

I've filed ticket #117 in order to make sure to not forget this. Currently, I'm working on #113, which I believe has not triggered this problem, but the related changes will also imply a rewrite of the code that updates the client-side physics world, and so I'll probably look into #117 during my work at #113.

(Right now, I still have to send official press release mails regarding the 12.05 release, work on #113 will continue immediately afterwards.)
Best regards,
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest