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
JimMarlowe
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]
Origin=9641.873853,3849.323978,2541.630559,
View=-0.904089,-0.203202,-0.375942
Server RayResult Hit entity 61,
rfw=9.641874,3.849324,2.541631,
rtw=-9031.247070,-2028.171143,-3756.873779,
hnw=1.000000,0.000000,0.000000,
hpw=8.703486,3.638413,2.151427

Client player ID[15] heading[46846] pitch[4020]
Origin=9641.874023,3849.323975,2541.630615,
View=-0.904089,-0.203202,-0.375942
Client RayResult Hit entity 0,
rfw=9.641874,3.849324,2.541631,
rtw=-9031.247070,-2028.171143,-3756.873779,
hnw=0.000000,0.000000,1.000000,
hpw=5.484269,2.914865,0.812800

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

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,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests