Elite Square
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Support_ContainerRayCast - Making raycasting easier, one line at a time

3 posters

Go down

Support_ContainerRayCast - Making raycasting easier, one line at a time Empty Support_ContainerRayCast - Making raycasting easier, one line at a time

Post  Meshiest Fri Jan 04, 2013 2:42 am

Title:
Support for Container Raycasts

Author:
Meshiest

Description:
Shortens the amount of lines used in container Raycasts for players
This is also a resource

Usage:
Turning this:
Code:
%start = %this.getEyePoint();
%vec  = %this.getEyeVector();
%end  = vectorAdd(%start,vectorScale(%vec,%distance));
%ray = containerRaycast(%start,%end,%type,%this);
%col = firstWord(%ray);
into this:
Code:
%playerObject.getRayCastObject(%distance,"TypeMask [player/p,vehicle/v,brick/b,alwaysbrick/ab]")

FOR EXAMPLE, if you wanted to get the first vehicle in sight for 64 bricks (32 torque units) you would do:
Code:
talk(findclientbyname("Meshiest").player.getRayCastObject(32,"vehicle"));
and it would return the ID of the first vehicle in front of the player within 64 bricks (32 torque units)

Download:
>>Download<<
or
Download: http://www.mediafire.com/download.php?h12rzlu5i2463w9


Last edited by Meshiest on Sun Jan 06, 2013 6:34 pm; edited 1 time in total

Meshiest
Blocklandian

Posts : 68
Join date : 2013-01-02
Age : 26
Location : The Internet

http://marblemodz.forumotion.com

Back to top Go down

Support_ContainerRayCast - Making raycasting easier, one line at a time Empty Re: Support_ContainerRayCast - Making raycasting easier, one line at a time

Post  Innocent Fri Jan 04, 2013 6:44 pm

Might be really useful, thanks!
Innocent
Innocent
Blocklandian

Posts : 17
Join date : 2012-12-31
Age : 28
Location : Montreal

Back to top Go down

Support_ContainerRayCast - Making raycasting easier, one line at a time Empty Re: Support_ContainerRayCast - Making raycasting easier, one line at a time

Post  Meshiest Fri Jan 04, 2013 7:26 pm

Innocent wrote:Might be really useful, thanks!
I know, I always forgot the code for container raycasts Razz

Meshiest
Blocklandian

Posts : 68
Join date : 2013-01-02
Age : 26
Location : The Internet

http://marblemodz.forumotion.com

Back to top Go down

Support_ContainerRayCast - Making raycasting easier, one line at a time Empty Re: Support_ContainerRayCast - Making raycasting easier, one line at a time

Post  Honor Sat Jan 05, 2013 2:30 pm

Might use this sometime..
Honor
Honor
Admin

Posts : 56
Join date : 2012-12-27
Age : 26

https://elitesq.forumotion.com

Back to top Go down

Support_ContainerRayCast - Making raycasting easier, one line at a time Empty Re: Support_ContainerRayCast - Making raycasting easier, one line at a time

Post  Meshiest Sat Jan 05, 2013 4:39 pm

Honor wrote:Might use this sometime..
for v2, i might add support for any object instead of just players Razz

Meshiest
Blocklandian

Posts : 68
Join date : 2013-01-02
Age : 26
Location : The Internet

http://marblemodz.forumotion.com

Back to top Go down

Support_ContainerRayCast - Making raycasting easier, one line at a time Empty Re: Support_ContainerRayCast - Making raycasting easier, one line at a time

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum