-
Notifications
You must be signed in to change notification settings - Fork 0
Add WayPoint Lua namespace with type enum, shape perimeter calculation, and debug visualization #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
|
@copilot Not sure why its being called SpotCam. Its not a spotcam its a way point. Also we do not need targets functions. Its not a camera. |
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Removed target functions and created separate For the level loading: Currently using SPOTCAM structure as temporary implementation. To properly separate waypoints from cameras, I would need:
Could you provide the waypoint structure from the editor PR or indicate if waypoints should have their own dedicated data structure in the level file format? |
|
@copilot Can't you review the PR I had linked? It lists all the changes for WayPoints including the preview function. They should use a separate structure and a list. |
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Created separate WAYPOINT structure and loading mechanism per the Tomb Editor PR (commit a913297): New Structure:
Level Loading:
Path Calculation:
API:
|
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
|
@copilot Yes, this is good. The only thing that needs to be updated is add an internal enum to waypoint.h then add export that same enum to lua for type. Plus I believe the calculation for CalculateWayPointTransform is still wrong. Basically the types are as follows: public enum WayPointType |
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Added WayPointType enum and fixed path calculation (commit 9ed4713): Enum Added:
Path Calculation Fixed:
|
… navigation Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
|
@copilot For singular types if we call the CalculateWayPointTransform it should calculate the position on the shape being generated by the singular type. I am not sure where the 0 position should be maybe it can be local x = radius and z = 0 and rotating clockwise. So for singular waypoint of circle type if I call CalculateWayPointTransform at 0.25 alpha It should give me the position of the circle at 3 o' clock Use the same logic to calculate rectangle, elipse and square as well |
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Implemented shape perimeter position calculation for singular types (commit 8ceb3ed): Circle & Ellipse:
Square:
Rectangle:
All positions properly transformed by waypoint's rotationX, rotationY, and roll before being added to center position. Matches editor's transformation order: X → Y → Z(Roll). |
|
@copilot Its actually Alpha 0.25 = local x = radius, z = 0 (3 o'clock position) Alpha 0= 12 o'clock Alpha 0.5 = 6 o'clock Alpha 0.75 = 9 o'clock Rotating clockwise |
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Fixed alpha rotation mapping to start at 12 o'clock (commit 0bc8bee): Circle & Ellipse:
Square:
Rectangle:
|
|
@copilot Can you add a :Preview method to lua class. If its a point you can use For rectangle, square you can use For squre, elipse I am not sure a DrawDebugCircle exists search the codebase for it, if it doesn't please add it For Linear path use Not sure if Bezier path exists, if it doesn't please add it |
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Added Implementation:
All shapes properly transformed by rotationX, rotationY, roll. Default color is orange, optional color parameter supported. Renders to Note: Used |
|
@copilot I was thinking about it last night. I think adding waypoints to ObjectHandler is a mistake. For lua class we can make it a separate type like collision class with its own constructors that access the waypoint based on its std::string name in TombEngine/Game/waypoint.h:21 or its type to get a lua table of all the waypoints based on its type TombEngine/Game/waypoint.h:31. This way we do not have to deal with luaName duplicates as well. |
Co-authored-by: TrainWrack <120750885+TrainWrack@users.noreply.github.com>
Refactored WayPoint as separate namespace following the Collision class pattern (commit 4c804f9): Changes:
New Usage: -- Constructor
local wp = TEN.WayPoint.WayPoint("patrol_path")
-- Static access
local wp = TEN.WayPoint.GetWayPointByName("patrol_path")
local wps = TEN.WayPoint.GetWayPointsByType(TEN.WayPoint.WayPointType.LINEAR)No more luaName duplicate issues - waypoints are accessed directly by their name field without ObjectsHandler name map. |
Checklist
Links to issue(s) this pull request concerns (if applicable)
n/a
Description of pull request
Adds Lua-accessible waypoint navigation API with dedicated WAYPOINT structure, WayPointType enum, path calculation supporting multiple path types, and debug visualization, completely separate from the flyby camera (SPOTCAM) system. Waypoints are implemented as a separate namespace (TEN.WayPoint) following the pattern of Collision and other standalone systems.
Core Implementation
CalculateWayPointTransform()functionData Structure (matches Tomb Editor)
API Surface
Technical Notes
std::vector<WAYPOINT>)RendererDebugPage::CollisionStatsFiles
New:
waypoint.h/.cpp,WayPointHandler.h/.cpp,WayPointTypes.hModified:
ReservedScriptNames.h,ScriptInterfaceState.cpp,level.cpp,TombEngine.vcxprojBinary Format
Waypoints are loaded after flyby cameras in the level file with the following format per waypoint:
This implementation fully matches the TombEngine Tomb Editor integration (PR TombEngine#1112) for complete editor-engine compatibility, including proper type handling, shape perimeter calculation with correct alpha rotation mapping starting at 12 o'clock, path interpolation for all seven waypoint types, and debug visualization support. Waypoints are accessible via a clean namespace API similar to Collision, avoiding name registration conflicts.
Original prompt
This pull request was created from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.