Adding a vehicle to Lyra

As someone with a very surface level understanding of lyra (adding custom weapons, animations and maps) how feasible would it be for me to add vehicles? Would I have to interact with a lot of server code to make this work? Where would I begin, is it worth trying?

1 Like

This is my main goal in Lyra. Either posses a vehicle or another character. But it is not as simple as in ordinary UE.
I am able to posses a vechicle and drive it around. But when I return to my Lyra character then input is frozen, I cannot move or look around.
I am very interrested in the subject if anyone can hint me in the right direction.

1 Like

Update:
Forwarding input from the character is the way to do it, rather than possession.

Possession isn’t necessary or ideal for a number of reasons.

1 Like

I saved the Lyra pawn as a variable and did a re-possess.
The ingame debugging shows this debug info:
Left is before possess. Right is after.

Left shows the avatar name, right dont show this.
Left shows 11 grey GA_, right shows same GA_s but with status CantActivate

Maybe this can point someone in the right direction of how to repossed the Lyra Character after possessing a vehicle.

Hey, I am in a similar situation where I am unable to control my character once I exit my car. Can u pls elabprate the solution so that I can solve the issue? Any help will be really helpful.

Hey there, I am currently in a similar situation where I can drive through the map in my car. However, once I exit and possess my character, It’s frozen. Cant move or act. No inputs work. Im curious to know if you have figured out a way.

Don’t use possession but forward inputs instead.
On input event… if in vehicle, tell vehicle to do something.

does that work with multiplayer?

That’s what I do because of multiplayer… Lyra specifically.
I’m sure it’s what Fortnite does.

It becomes more to consider when you start thinking about damage and death for example.

Hi all,

Astraa makes a good argument for using input forwarding, but in the context of possession I’m also stumped.

I added Chaos vehicles to Lyra. (remember to enable the chaos vehicles plugin) but am having similar input problems. Using this to Possess the vehicle works, but doing the same nodes in reverse (in vehicle BP) when trying to unpossess the vehicle / repossess B_SimpleHeroPawn does not give me back walking pawn control. (As mentioned above)

I guess the next step would be to figure out how to debug the enhanced input system. (What mapping contexts are active? Is my keypress being recognized?)

The link is invalid/expired… Can you please send another? Would like to join the community…

Aside from that… Its crazy how little content is findable online to have lyra and vehicles combined…

Like, lyra ability to enter and drive the matrix vehicles with their destruction, would be such a nice combination…

This link never expires and welcome :slight_smile:

I really want to get this working in my game, could I see your blueprint? Thank you!

Hi did you ever get this working correctly?

What part are you stuck on?
I want to make a guide. Just haven’t gotten to it yet.
Here’s a working example: Lyra // Chaos Vehicle // Unreal Engine 🚙💨 - YouTube

Here’s how I did it

I added a variable inside the ALyraPlayerController class to record whether it is entering the carrier or not, and determine in the OnUnPossess method whether further processing should be done

The code is as follows.

void ALyraPlayerController::OnUnPossess()
{
	if (IsInVehicle == false)
	{
		// Make sure the pawn that is being unpossessed doesn't remain our ASC's avatar actor
		if (APawn* PawnBeingUnpossessed = GetPawn())
		{
			if (UAbilitySystemComponent* ASC = UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(PlayerState))
			{
				if (ASC->GetAvatarActor() == PawnBeingUnpossessed)
				{
					ASC->SetAvatarActor(nullptr);
				}
			}
		}
	}
	
	Super::OnUnPossess();
}

Just save a variable of hero’s pawn inside the blueprint corresponding to the ALyraPlayerController, and you can use Possess to switch carriers

But there are still UMG and some other issues to deal with

Lyra does things by default when you possess and unpossess, including executing Game Feature Actions that swap in/out widgets and Enhanced Input IMCs.

You’re on the right track.

all of it hahah.

Yes, the possess will also hide the character display in ULyraControllerComponent_CharacterParts, I plan to change the way the character is displayed instead of ULyraControllerComponent_CharacterParts, which involves more and more things :slight_smile:

1 Like