-
Notifications
You must be signed in to change notification settings - Fork 107
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
Controllable NPC Vehicle feature #378
Open
szylis
wants to merge
15
commits into
main
Choose a base branch
from
feature/controllable-npc-vehicle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Remove RequireComponent attribute to allow use componentes of VehicleInputBase type with other input manager than VehicleOverrideInputManager. - Add option to disable possibility to switch to manually input.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ControllableNPC feature allows the user to control a NPC vehicle, when EGO is in Autonomous mode. The user can set the type of NPC vehicle to control and the spawn location of this vehicle.
Info about this new type of vehicle
ControllableNPCVehicle is a non-EGO vehicle that can be controlled by the user. To simplify the design and reuse some ready-made scripts, this type of vehicle uses some functionality of the EGO vehicle. Therefore, the prefab composition and included components are similar to the EGO vehicle.
However, Controllable NPC vehicle does not contain any sensors and it does not support autonomous mode.
This PR adds:
Prefabs:
ControllableNPCVehicleManager.prefab
ControllableNPCVehicleUI.prefab
Components:
ControllableNPCVehicleManager
- handles all elements required by the controllable NPC vehicle, including spawning the selected vehicle, and initializing its camera view. Additionally, it serves as an intermediary between the vehicle object and theControllableNPCVehicleUI
, facilitating tasks such as retrieving collision information and passing it to the UI view.ControllableNPCVehicleUI
- displays the UI for controllable NPC vehicle, such as top-down camera view, info about current speed and gear shift, info about collisions and dropdown menu to select the input device.ControllableNPCVehicleOverrideInputManager
- input manager designed for this type of vehicle. It supports only manual input.ControllableNPCVehicleCollisionDetector
- used to detect when the controllable vehicle collides with other specified objects.ControllableNPCVehicleCamera
- used to handle the camera view of controllable NPC vehicle.Implemented changes to existing code
[RequireComponent(typeof(VehicleOverrideInputManager))]
attribute fromVehicleInputBase
class. This attribute is typically employed to ensure a specific setup and to prevent setup errors, however I believe in this case, it's not necessary. Because theVehicleInputBase
does not actually depend on theVehicleOverrideInputManager
. Removing this attribute allows me to use already existing input components (like theVehicleKeyboardInput
), together with the ControllableNPCOverrideInputManager. TheControllableNPCOverrideInputManager
is dedicated input manager for ControllableNPC Vehicle.VehicleOverrideInputManager
. This allows it to keep EGO in autonomous mode when ControllableNPC Vehicles are used.