Blockland Forums > Modification Help
Getting an objects id by looking at it.
Pah1023:
I am needing this for a little project I am working on that I might release if people likes the idea.
Anyway to make it short I just a command to get the ID of an object that the players aiming at, like the /getid command.
I know it has something to do with raycasts and crap which I was never good at it.
Nexus:
--- Code: ---%target = containerRayCast(%cl.player.getEyePoint(), vectorAdd(vectorScale(vectorNormalize(%cl.player.getEyeVector()), 5), %cl.player.getEyePoint()), $typeMasks::playerObjectType).client;
--- End code ---
This gets the client that a player is looking at.
just replace .client; with .getid();
Pah1023:
Thanks I will try that out.
Placid:
--- Quote from: Nexus on July 17, 2011, 08:23:10 PM ---
--- Code: ---%target = containerRayCast(%cl.player.getEyePoint(), vectorAdd(vectorScale(vectorNormalize(%cl.player.getEyeVector()), 5), %cl.player.getEyePoint()), $typeMasks::playerObjectType).client;
--- End code ---
This gets the client that a player is looking at.
just replace .client; with .getid();
--- End quote ---
on a related note, so i'm not posting a whole new topic, is there a way to get the direction in x y z of a player's looking? so that i could add velocity to a vehicle in that direction?
Amade:
--- Quote from: Placid on July 17, 2011, 09:19:11 PM ---on a related note, so i'm not posting a whole new topic, is there a way to get the direction in x y z of a player's looking? so that i could add velocity to a vehicle in that direction?
--- End quote ---
player.getEyeVector()