Skip to content
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

Add getVehicleEntryPoints #2566

Merged
merged 16 commits into from
Jul 30, 2024

Conversation

MegadreamsBE
Copy link
Member

@MegadreamsBE MegadreamsBE commented Mar 6, 2022

Fixes #2565

This PR adds a new function called getVehicleEntryPoints which returns a table containing the positions to 4 possible entry points to a vehicle. Note that this does not directly relate to the amount of doors a vehicle has as vehicles with two doors can have multiple entry points to the same door. This usually influences the type of animation that is being used which is most prominent with bikes (stepping onto the bike vs jumping onto it).

This function can be used alongside setPedEnterVehicle to make a ped enter a specific seat by first moving the ped to a entry point retrieved through getVehicleEntryPoints and then using setPedEnterVehicle to make them enter. At this time setPedEnterVehicle gives you no such control.

The non-OOP version returns a table containing 4 tables itself which hold the x, y, z coordinates of each entry point. The OOP version returns a table containing 4 Vector3's instead. When no entry points exist for a vehicle it will return false.

Test resources for both the non-OOP as OOP version of this function are provided on the bottom of this PR. These test resources display the entry points for each vehicle near you as seen in the screenshot below:

proxy_sa_2022-03-06_15-58-21

entrypoints.zip
entrypoints-oop.zip

@lopezloo lopezloo added the enhancement New feature or request label Mar 7, 2022
@Einheit-101
Copy link

are these points hardcoded or are they somehow affiliated with the seat or door dummy?

@MegadreamsBE
Copy link
Member Author

are these points hardcoded or are they somehow affiliated with the seat or door dummy?

Looking at the underlying logic of GetPositionToOpenCarDoor which is used by the game to figure out what point to get the ped to before making it enter the vehicle (it also causes the endless going around the vehicle as it tries to line up per the ALIGN task) it does seem to calculate these from some of the vehicle's dummies. Unfortunately I can't say for certain what these exact dummies are and how it derives these entry points from it.

@MegadreamsBE MegadreamsBE requested a review from Pirulax March 31, 2022 14:03
Client/mods/deathmatch/logic/CClientVehicle.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.h Outdated Show resolved Hide resolved
@patrikjuvonen patrikjuvonen marked this pull request as draft December 30, 2022 19:58
@patrikjuvonen patrikjuvonen added the feedback Further information is requested label Dec 30, 2022
@MegadreamsBE MegadreamsBE marked this pull request as ready for review March 12, 2023 22:32
@MegadreamsBE MegadreamsBE requested review from tederis and removed request for Pirulax March 12, 2023 22:32
@MegadreamsBE MegadreamsBE force-pushed the feature/entry-points branch from 0a738a3 to 07c19f2 Compare April 15, 2024 05:04
@Fernando-A-Rocha
Copy link
Contributor

Good idea! Is the code ready?

@MegadreamsBE
Copy link
Member Author

Good idea! Is the code ready?

Yes, it's been ready for quite a while. Just waiting for this to be reviewed.

Client/game_sa/CCarEnterExitSA.cpp Outdated Show resolved Hide resolved
Client/game_sa/CCarEnterExitSA.h Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.h Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp Outdated Show resolved Hide resolved
@MegadreamsBE MegadreamsBE requested a review from TracerDS May 9, 2024 21:46
@MegadreamsBE
Copy link
Member Author

Hmm, bit of an oversight I need to solve. Didn't consider that changing to CVector as per your request @TracerDS it would also make the non-OOP version return a vector which is not expected. Any suggestions on how to best solve that scenario?

@MegadreamsBE MegadreamsBE force-pushed the feature/entry-points branch from 0500406 to 2b32d79 Compare June 6, 2024 03:02
@MegadreamsBE MegadreamsBE requested a review from Pirulax June 6, 2024 13:23
Client/game_sa/CCarEnterExitSA.h Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.h Outdated Show resolved Hide resolved
Client/sdk/game/CCarEnterExit.h Outdated Show resolved Hide resolved
@MegadreamsBE MegadreamsBE requested a review from tederis June 6, 2024 14:39
Client/sdk/game/CCarEnterExit.h Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientVehicle.cpp Outdated Show resolved Hide resolved
@MegadreamsBE MegadreamsBE requested a review from tederis June 6, 2024 14:58
@Dutchman101 Dutchman101 merged commit bf588c1 into multitheftauto:master Jul 30, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feedback Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way to get the entry points to a vehicle
10 participants