Raycasting searched id not I want
by S P Simon Shum · in Torque Game Engine · 10/28/2007 (10:00 am) · 3 replies
Hi all, hope you can help me with this problem
I am developing a Server based 3-rd person action game with torque 1.52.
The problem is that I wrote a function to search and displayed the player id and bot id by using "InitContainerRadiusSearch", but find out that the result searched of the player id were not the same as the id of the ServerConnection.player
For more detail, please see the attached console below.
How can I search the correct player id by using some raycasting function?
This is big project for me and new to use Torque,
Really appreciate for any helps!!!
I am developing a Server based 3-rd person action game with torque 1.52.
The problem is that I wrote a function to search and displayed the player id and bot id by using "InitContainerRadiusSearch", but find out that the result searched of the player id were not the same as the id of the ServerConnection.player
For more detail, please see the attached console below.
.... ServerConnection.player 4801 //the id I need InitContainerRadiusSearch(): Player %client.player.getShapeName() DemoPlayer %client.player 4798 -- Search -- Player Pos = 375.663 303.411 218.302 Target Pos = 375.663 303.411 218.302 Target Id = 4798 Classname() = Player Target Name = DemoPlayer - End Search - mouse click AI id: 4813 //the id I need InitContainerRadiusSearch(): AI -- Search -- Player Pos = 375.663 303.411 218.302 Target Pos = 371.039 301.045 217.832 Target Id = 4753 Classname() = AIPlayer Target Name = dead orc - End Search - ....
How can I search the correct player id by using some raycasting function?
This is big project for me and new to use Torque,
Really appreciate for any helps!!!
About the author
#2
What you are seeing is the container radius search results returning server side object ID's, while you are comparing them to client side ghosted object ID's. Those are different by design, and you'll need to resolve them using the built in NetConnection resolvers (a good article can be found on TDN: Torque Ghosting.
10/28/2007 (3:02 pm)
As always, great write-up by Orion--he's exactly correct :)What you are seeing is the container radius search results returning server side object ID's, while you are comparing them to client side ghosted object ID's. Those are different by design, and you'll need to resolve them using the built in NetConnection resolvers (a good article can be found on TDN: Torque Ghosting.
Associate Orion Elenzil
Real Life Plus
"ServerConnection" is the client-side object representing the connection between the client and the server.
"ServerConnection.player" is the client-side ghost of your player object.
InitContainerRadiusSearch and the rayCast function, however, are only meant to be used server-side,
and as such are returning the server-side copies of the player.
depending on what you're doing, you could modify the radius search and raycast functions to optionally work client-side as well, or you should ensure that your radius search is happening on the server.
if what you want to do is say display they names of nearby players, i'd recommend doing it client-side.
if you want to determine which players get blown-up by an explosion or something, that would be better server-side.