What is Meant By Ray Casting
by CloudFire · in Torque 3D Beginner · 06/11/2010 (4:45 am) · 2 replies
Hi All
Could any one explain What is Meant By Raycasting. I have a Question Mark Dts. If the Dts was Clicked then the MessageBox(quiz Question Should popup). How i can do it. Here i have found some code. But i dont know how to identify the QuestionMark dts was clicked.
function PlayGui::onMouseDown(%this, %pos, %start, %ray)
{
%client = localClientConnection;
%player = %client.getControlObject();
%start = %player.getEyePoint();
%rayLength = 1000;
%rayDirection = VectorScale(%player.getEyeVector(), %rayLength);
%end = VectorAdd(%start, %rayDirection);
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::StaticObjectType | $TypeMasks::ShapeBaseObjectType;
%rayInfo = ContainerRayCast(%start, %end, %mask, %player);
if (getWordCount(%rayInfo))
{
%object = getWord(%rayInfo, 0);
%point = getWords(%rayInfo, 1, 3);
%normal = getWords(%rayInfo, 4, 6);
} else {
return 0;
}
How can i get the Question Mark dts Objects Name? for that what code i have to add?
#2
07/12/2010 (12:06 pm)
Place the following inside the if statement:if (%object.getName() $= "QuestionMark")
{
MessageBoxYesNo...
}
CloudFire