Game Development Community

ContainerRayCast on dedicated client

by Kiyaku · in Torque Game Engine · 10/06/2008 (12:00 pm) · 6 replies

Hi,
i was wondering if it's possible to do a RayCast on the dedicated client. I tried to make a raycast script on the client but it can't find anything. When i use the same script as Client/Server, it works perfectly.

Is it possible to do the raycast only on the client? Cause i need it for an online game and i have to use it for my own Aiming system. I only want to "hit" the enemy when i went over him with my crosshair. So i want to scan with the raycast for objects, and when i shoot, send the selected enemy ID to the server to calculate the damage.

Thanks in advance

#1
10/06/2008 (12:25 pm)
There's no such thing as a Dedicated Client so I assume you're referring to a Dedicated Server.

In any case, the RayCast script functions are only setup to use the Server container, so you can't use them on the client. However, changing that is trivial (change all instances of gServerContainer to gClientContainer).
#2
10/06/2008 (12:31 pm)
I meant a client only, not client+server so i said Dedicated client.

So i just have to create a second raycast function that refers to the gClientContainer? I could try do that.
#3
10/06/2008 (7:24 pm)
Thanks a lot, that worked!
#4
10/07/2008 (2:41 am)
Glad to hear!
#5
10/07/2008 (3:33 am)
Kiyaku - Please be aware though that the object id's returned by your client side raycast will be the object id's on the client which won't match those on the server if you try and pass them back again, you'll need to go through the process of resolving Ghost indexes to pass it to a server.
#6
10/07/2008 (7:53 am)
Right, so i'm getting his charname with "getShapeName" which works.