Data Realms Fan Forums
http://45.55.195.193/

Request: Tutorial
http://45.55.195.193/viewtopic.php?f=75&t=16915
Page 1 of 1

Author:  ZevN47 [ Thu Oct 22, 2009 3:07 pm ]
Post subject:  Request: Tutorial

I have searched for a tutorial on Ray casting and Can not seem to find one.

So if anyone could make a tutorial on rays that would be very very very helpful.

Possible ideas:

Example code and indepth documentation of every (or the non-self explanatory) lines

Description of what to use Rays for and how to use them

Update the Documentation in the Wiki (that is the first thing I go to when I want to make Lua but I can't seem to figure out Ray casting from the wiki)

Thank you very much! and if anyone knows of a tutorial that I didn't find (I searched) then let me know (link to it or something). Also Please if you make this keep the jargon to a minimum I have a basic understanding of Lua and C++ however I am quite good at Visual Basic and .ini coding (who isn't) :)

Author:  Zylos Xenos [ Fri Mar 26, 2010 1:39 pm ]
Post subject:  Re: Request: Tutorial

Ray Casting Tutorial

G'luck, mate, hope this helps.

Author:  Duh102 [ Fri Mar 26, 2010 4:17 pm ]
Post subject:  Re: Request: Tutorial

Zylos Xenos wrote:
hope this helps.[/center]

No. No, that doesn't work.

MINI-MINI tutorial: How to use an ObstacleRay (the only one I've ever used, but the same should apply to other types)

An ObstacleRayCast returns a number corresponding to how long the ray went before it collided with an object, and the syntax is as follows:
(variable) = SceneMan:CastObstacleRay(
[Vector starting position],
[Vector direction to cast ray along],
[Vector reference (you can make an empty vector) to fill in the coordinates of the first obstacle encountered, if applicable, or end of ray],
[Vector reference (can make empty) to fill in the last free coordinates before the ray hit non-MOs, if applicable, or end of ray],
[A MOID to ignore, children will also be ignored],
[Material ID to ignore hits with],
[How many pixels to skip in between checks (0 will check every pixel, IE, slower)]
);

Put it all together and it looks like this:
self.length = SceneMan:CastObstacleRay(self.Pos, self.Vel * 150, Vector(0, 0), Vector(0, 0), self.ID, 0, 5);

In case you haven't found it already, that and other types of rays can be found documented here.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/