T3D MIT 3.5 Bug Triggers not working after saving mission with FIX
by Richard Marrevee · in Torque 3D Professional · 11/22/2013 (2:40 pm) · 7 replies
Build: Torque3D Open Source 3.5
Platform: Windows XP
Target: Editors, Visual Studio
Issue:
After adding a trigger in the worldeditor and saving the mission file the trigger is not working.
Steps to repeat:
1. Launch the world editor.
2. Add a Trigger to the mission and add some enter, leave and tickcommands (something like echo("Enter");...)
3. Enter trigger and you will see the trigger respond.
4. Save Mission.
5. Reload the mission.
6. Now enter the trigger. Nothing happens.
Suggested Fix:
All is caused by the fix for Issue 510: Vector parse order within Trigger::castRay is inconsistent. Revert it and all is working as expected.
Edit:
Fix can be found in post #4
Platform: Windows XP
Target: Editors, Visual Studio
Issue:
After adding a trigger in the worldeditor and saving the mission file the trigger is not working.
Steps to repeat:
1. Launch the world editor.
2. Add a Trigger to the mission and add some enter, leave and tickcommands (something like echo("Enter");...)
3. Enter trigger and you will see the trigger respond.
4. Save Mission.
5. Reload the mission.
6. Now enter the trigger. Nothing happens.
Suggested Fix:
All is caused by the fix for Issue 510: Vector parse order within Trigger::castRay is inconsistent. Revert it and all is working as expected.
Edit:
Fix can be found in post #4
About the author
Started programming in 1984 on an Oric, when time progressed switched to MSX, Amiga and finally the Windows PC with T3D. Now developing an epic fantasy game: The Master's Eye. Creator of the DoorClass pack and VolumetricFog pack @ richardsgamestudio.com
#2
The reason for using the previous order of 0, 2, 1 instead of 0, 1, 2 (the fix for issue 510) is in my opinion that the polyhedrons are setup with edges CCW instead of CW and normals facing out instead of inside. Look a little bit further in trigger.cpp to see how the polyhedrons are setup in the ConsoleSetType( TypeTriggerPolyhedron ) function. And the mentioned fix is for the ConsoleGetType( TypeTriggerPolyhedron ), for certain not for the Trigger::castRay function.
11/23/2013 (11:55 am)
@Dwarf King: These elements are added when saving a mission in the world-editor.The reason for using the previous order of 0, 2, 1 instead of 0, 1, 2 (the fix for issue 510) is in my opinion that the polyhedrons are setup with edges CCW instead of CW and normals facing out instead of inside. Look a little bit further in trigger.cpp to see how the polyhedrons are setup in the ConsoleSetType( TypeTriggerPolyhedron ) function. And the mentioned fix is for the ConsoleGetType( TypeTriggerPolyhedron ), for certain not for the Trigger::castRay function.
#3
12/29/2013 (9:49 pm)
Has anyone had any luck with fixing this issue with triggers? I've also noticed the third person camera will actually treat the trigger box as a solid object and the camera will collide with it.
#4
In Engine\source\T3D\trigger.cpp search for the function:
ConsoleGetType( TypeTriggerPolyhedron )
which should be around line 242.
Now change the following 2 marked lines:
12/30/2013 (4:32 am)
To make this work again you have to reverse the change made for version 3.5:In Engine\source\T3D\trigger.cpp search for the function:
ConsoleGetType( TypeTriggerPolyhedron )
which should be around line 242.
Now change the following 2 marked lines:
AssertFatal(currVec == 3, "Internal error: Bad trigger polyhedron");
// Build output string.
char* retBuf = Con::getReturnBuffer(1024);
dSprintf(retBuf, 1023, "%7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f",
origin.x, origin.y, origin.z,
vecs[0].x, vecs[0].y, vecs[0].z,
vecs[2].x, vecs[2].y, vecs[2].z,// Change this line, was vecs[1]
vecs[1].x, vecs[1].y, vecs[1].z);// and this line, was vecs[2]
return retBuf;
#5
I had to restore the triggers in the mission files with code from backups as well.
12/30/2013 (9:43 am)
Good catch @Richard, thanks for sharing!I had to restore the triggers in the mission files with code from backups as well.
#7
01/06/2014 (5:17 am)
.
Torque Owner Dwarf King
Noble Games Production
in your
@ ?