mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
add follow logic
select follow target and toggle follow for a specific object. Only way to unfollow is to move the following bot to an arbitrary location
This commit is contained in:
parent
0b96579ada
commit
3946017556
6 changed files with 155 additions and 55 deletions
|
|
@ -294,7 +294,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
{
|
||||
internalName = "SelectActions";
|
||||
position = "7 21";
|
||||
extent = "190 64";
|
||||
extent = "190 136";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "ToolsGuiButtonProfile";
|
||||
|
|
@ -370,7 +370,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
{
|
||||
internalName = "LinkActions";
|
||||
position = "7 21";
|
||||
extent = "190 64";
|
||||
extent = "190 136";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "ToolsGuiButtonProfile";
|
||||
|
|
@ -386,7 +386,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
{
|
||||
internalName = "CoverActions";
|
||||
position = "7 21";
|
||||
extent = "190 64";
|
||||
extent = "190 136";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "ToolsGuiButtonProfile";
|
||||
|
|
@ -411,7 +411,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
{
|
||||
internalName = "TileActions";
|
||||
position = "7 21";
|
||||
extent = "190 64";
|
||||
extent = "190 136";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "ToolsGuiButtonProfile";
|
||||
|
|
@ -427,7 +427,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
{
|
||||
internalName = "TestActions";
|
||||
position = "7 21";
|
||||
extent = "190 64";
|
||||
extent = "190 136";
|
||||
new GuiControl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
Extent = "190 20";
|
||||
|
|
@ -481,7 +481,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
Extent = "90 18";
|
||||
text = "Delete";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
tooltip = "Delete Selected.";
|
||||
tooltip = "Delete Selected Bot.";
|
||||
command = "NavMeshTools->TestTool.getPlayer().delete();NavInspector.inspect();";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
|
|
@ -505,7 +505,7 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Extent = "90 18";
|
||||
text = "Follow";
|
||||
text = "Select Follow";
|
||||
command = "NavMeshTools->TestTool.followObject();";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
|
|
@ -519,6 +519,20 @@ $guiContent = new GuiNavEditorCtrl(NavEditorGui, EditorGuiGroup) {
|
|||
command = "NavMeshTools->TestTool.stop();";
|
||||
};
|
||||
};
|
||||
new GuiControl() {
|
||||
profile = "GuiDefaultProfile";
|
||||
Extent = "190 18";
|
||||
|
||||
new GuiButtonCtrl() {
|
||||
Profile = "ToolsGuiButtonProfile";
|
||||
buttonType = "PushButton";
|
||||
HorizSizing = "right";
|
||||
VertSizing = "bottom";
|
||||
Extent = "90 18";
|
||||
text = "Toggle Follow";
|
||||
command = "NavMeshTools->TestTool.toggleFollow();";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
new GuiContainer(NavEditorInspector){
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ function NavMeshTestTool::onActivated(%this)
|
|||
%properties->TestProperties.setVisible(false);
|
||||
|
||||
%classList = enumerateConsoleClasses("Player") TAB enumerateConsoleClasses("Vehicle");
|
||||
echo(%classList);
|
||||
//echo(%classList);
|
||||
|
||||
SpawnClassSelector.clear();
|
||||
foreach$(%class in %classList)
|
||||
|
|
@ -498,6 +498,23 @@ function NavMeshTestTool::stop(%this)
|
|||
}
|
||||
}
|
||||
|
||||
function NavMeshTestTool::toggleFollow(%this)
|
||||
{
|
||||
|
||||
if(isObject(%this.getFollowObject()) && isObject(%this.getPlayer()))
|
||||
{
|
||||
if(%this.getPlayer().isMemberOfClass("AIPlayer"))
|
||||
%this.getPlayer().followObject(%this.getFollowObject(), "2.0");
|
||||
else
|
||||
%this.getPlayer().getAIController().followObject(%this.getFollowObject(), %this.getPlayer().getDatablock().aiControllerData.mFollowTolerance);
|
||||
}
|
||||
}
|
||||
|
||||
function NavMeshTestTool::followObject(%this)
|
||||
{
|
||||
%this.followSelectMode();
|
||||
}
|
||||
|
||||
function SpawnClassSelector::onSelect(%this, %id)
|
||||
{
|
||||
%className = %this.getTextById(%id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue