Need quick answeres regarding some Torque features
by John Yates · in Torque Game Engine · 06/13/2006 (3:58 pm) · 4 replies
Hi,
I am really pressed with developing a demo
so quick and clear answers would be very much appreciated.
So far I have a terrain with objects and a bot spawned and running over a predefined path.
I cannot seem to be able to make normal dts objects fly a path. How do I do that?
How do I make sure the dts collides with everthing that has a collision mesh while moving?
(I followed a tutorial and I know how to attach the correct collision mesh and export it).
I need to allow the user to click on the screen and to show a message box when the user clicked on the simple dts. That dts is trying to avoid the mouse cursor by hiding nehind objects in the screen. So far, I've managed to show the mouse cursor by using Canvas but no clicking. How would that clicking work? I assume some form of ray cast.
Lastly, my spawned bot has dynamic shadows but the dts objects don't. If I put the demo.exe in the SDK/examples folder, then I get a very bright scene, except everything is shadowed properly. How is that and how can I turn on shadows for my normal dts hovering and hiding objects?
Please help, I am days away from deadline.
Thanks.
I am really pressed with developing a demo
so quick and clear answers would be very much appreciated.
So far I have a terrain with objects and a bot spawned and running over a predefined path.
I cannot seem to be able to make normal dts objects fly a path. How do I do that?
How do I make sure the dts collides with everthing that has a collision mesh while moving?
(I followed a tutorial and I know how to attach the correct collision mesh and export it).
I need to allow the user to click on the screen and to show a message box when the user clicked on the simple dts. That dts is trying to avoid the mouse cursor by hiding nehind objects in the screen. So far, I've managed to show the mouse cursor by using Canvas but no clicking. How would that clicking work? I assume some form of ray cast.
Lastly, my spawned bot has dynamic shadows but the dts objects don't. If I put the demo.exe in the SDK/examples folder, then I get a very bright scene, except everything is shadowed properly. How is that and how can I turn on shadows for my normal dts hovering and hiding objects?
Please help, I am days away from deadline.
Thanks.
#2
06/13/2006 (4:10 pm)
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=10359 - Updated object selection for 1.4
#3
I'll am looking into those.
I am using standard TGE, no packs and I have transformed the tutorial.base.
All objects are DTS, all coliision involved have collision meshes.
No DIFs as I would have tearing and texture waving on the Mac for a simple building made from the default
level in Quark. On the PC, the building would look fine though.
All the above mentioned happen in a single project, including bot and such.
06/14/2006 (4:28 am)
To Griffin:I'll am looking into those.
I am using standard TGE, no packs and I have transformed the tutorial.base.
All objects are DTS, all coliision involved have collision meshes.
No DIFs as I would have tearing and texture waving on the Mac for a simple building made from the default
level in Quark. On the PC, the building would look fine though.
All the above mentioned happen in a single project, including bot and such.
#4
The old one doesn't work and I don't have the TLK.
How do I add the mouse position in the directional vector for selection from script?
The following resides in "server\commands.cs" and it works when the middle of the screen in first person
has a collision enabled dif. When I swith to third person or toggle mouse look, the selection does not work anymore.
[SOURCE]
//---------------------------------------------------------------------
// object selection additions
//---------------------------------------------------------------------
function serverCmdSelectObject(%client)
{
// Specify how far the picking ray should extend into the world
%selectRange = 50;
%player = %client.player;
%eye = %player.getEyeVector();
%vec = vectorScale(%eye, %selectRange);
// startPoint = the player's eye position
// endPoint = startPoint + length of selectable range
%startPoint = %player.getEyeTransform();
%endPoint = VectorAdd(%startPoint, %vec);
// Search for anything that is selectable; below are some examples
%searchMasks = (
$TypeMasks::ShapeBaseObjectType |
$TypeMasks::ItemObjectType |
$TypeMasks::CorpseObjectType
);
%exempt = 0;
if ($selectedObj) %exempt = $selectedObj;
%object = ContainerRayCast(%startPoint, %endPoint, %searchMasks, %player, %exempt);
if(%object)
{
$selectedObj = firstWord(%object);
%client.setSelectedObject($selectedObj);
%name = $selectedObj.Name;//pickupName;
ChatHud.text = ChatHud.text @ "\r" @ %name @ " was selected.";
echo(%name @ " was selected.");
%selPos = $selectedObj.getPosition();
%offset = "0 0 0.7";//Vector(0, 0.1, 0);
%newPos = VectorAdd(%selPos, %offset);
$selectedObj.setTransform(%newPos);
commandToClient(%client, 'SetScoreCounter', 69);
}
else
{
ChatHud.addLine("No object selected.");
echo("No object selected.");
//ChatHud.text = ChatHud.text @ "\r" @ "No object selected.";
%selPos = $selectedObj.getPosition();
%offset = "0 0 -0.7";//Vector(0, 0.1, 0);
%newPos = VectorAdd(%selPos, %offset);
$selectedObj.setTransform(%newPos);
%client.clearSelectedObject();
$selectedObj = 0;
commandToClient(%client, 'SetScoreCounter', 0);
}
}
[/SOURCE]
06/24/2006 (10:47 am)
I've implemented the latest selection, but I need to allow mouse cursor selection.The old one doesn't work and I don't have the TLK.
How do I add the mouse position in the directional vector for selection from script?
The following resides in "server\commands.cs" and it works when the middle of the screen in first person
has a collision enabled dif. When I swith to third person or toggle mouse look, the selection does not work anymore.
[SOURCE]
//---------------------------------------------------------------------
// object selection additions
//---------------------------------------------------------------------
function serverCmdSelectObject(%client)
{
// Specify how far the picking ray should extend into the world
%selectRange = 50;
%player = %client.player;
%eye = %player.getEyeVector();
%vec = vectorScale(%eye, %selectRange);
// startPoint = the player's eye position
// endPoint = startPoint + length of selectable range
%startPoint = %player.getEyeTransform();
%endPoint = VectorAdd(%startPoint, %vec);
// Search for anything that is selectable; below are some examples
%searchMasks = (
$TypeMasks::ShapeBaseObjectType |
$TypeMasks::ItemObjectType |
$TypeMasks::CorpseObjectType
);
%exempt = 0;
if ($selectedObj) %exempt = $selectedObj;
%object = ContainerRayCast(%startPoint, %endPoint, %searchMasks, %player, %exempt);
if(%object)
{
$selectedObj = firstWord(%object);
%client.setSelectedObject($selectedObj);
%name = $selectedObj.Name;//pickupName;
ChatHud.text = ChatHud.text @ "\r" @ %name @ " was selected.";
echo(%name @ " was selected.");
%selPos = $selectedObj.getPosition();
%offset = "0 0 0.7";//Vector(0, 0.1, 0);
%newPos = VectorAdd(%selPos, %offset);
$selectedObj.setTransform(%newPos);
commandToClient(%client, 'SetScoreCounter', 69);
}
else
{
ChatHud.addLine("No object selected.");
echo("No object selected.");
//ChatHud.text = ChatHud.text @ "\r" @ "No object selected.";
%selPos = $selectedObj.getPosition();
%offset = "0 0 -0.7";//Vector(0, 0.1, 0);
%newPos = VectorAdd(%selPos, %offset);
$selectedObj.setTransform(%newPos);
%client.clearSelectedObject();
$selectedObj = 0;
commandToClient(%client, 'SetScoreCounter', 0);
}
}
[/SOURCE]
Torque Owner Griffin Milsap
That covers your flying DTS. Not sure how collision works out, but you should be able to mod it to your needs.
Object Selection - www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2173
Its a little old, and needs some modding to work in the torque 1.4 codebase, but it should work. I'm sure there are more resources on this. Its a pretty common problem.
Third, I don't know the particulars about this. Are you using TLK? What are the differences between the two projects? Are the shadowing objects DIF instead of DTS?
-Griff