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
Chaos vehicles not respawning even after changing to "Always respawn" #26
Comments
I added a test case to the SPUDExamples project which spawns a pawn on a trigger that is set to AlwaysRespawn, then saved and re-loaded (making sure not to activate the trigger again). The pawn was respawned correctly. |
I just tested with a character in my project, works without problems, same exact setup with the AWheeledVehiclePawn (Chaos vehicle) and it doesn't work, so it seems it's just the vehicle that's problematic. I am testing on UE5 early access, so it might not be a relevant issue for now It's odd because AWheeledVehiclePawn is just an APawn with a SkeletalMesh and a VehicleMovementComponent (which I did try adding to the character to see if it's causing problems and it doesn't) This is all there is to the AWheeledVehiclePawn.h, is there anything you see that might be making it incompatible with spud? I'm not too sure what UCLASS(abstract) does, but it shouldn't cause problems if it's subclassed from what I understand
My vehicle just inherits from it and adds the spud functionality
|
I'm happy that SPUD works at all with UE5, I haven't tested that yet :) I can't see anything wrong with the vehicle pawn, but perhaps it's something about its level ownership. All objects are loaded with the level they're owned by, so perhaps check that the vehicle spawn owner is the level you think it is? Otherwise it would be useful to see what the log says at save & load time. Are there any messages about this instance? |
Yes it works perfectly in UE5! I had to clean up the log as I had a lot of garbage being printed every frame, Found the problem, the vehicle wants to spawn at world origin, the world was above it so it was colliding and didn't spawn, but I'm not sure why it wants to spawn it there
|
I tried to dig a bit deeper and it seems SPUD works fine, it spawns the vehicle and sets the transform correctly, then the vehicle suddenly gets set to the origin on the next frame, seems more like a bug with the Chaos vehicle, maybe it's some sort of way to prevent it from flying into the air when it's spawned and its readjusts it's position after spawn.
|
I did actually find a problem with the respawn behaviour, it needs to set When the transform is set later, it's done like this:
This should reset any physics and have the same effect as spawning at that location, but I don't know if there's something that changed with Chaos. |
I had tried adding that myself when testing, will help with spawning if world origin is obstructed but didn't solve the problem with the vehicles for me. Is there a way to retrieve the transform saved data before the actor is created? |
No, the data structure for the levels is basically packed properties which are overlaid on top of existing actors (this is so that you can restore properties on top of actors which have had new state added since), and there's a separate list of respawns that need to happen before this to ensure the actors are there to update. This allows us to treat spawned actors and pre-existing actors the same, which is important because spawned actors might already exist, if for example you're quick-loading in game. |
Vehicles don't respawn when loading a game, I know they inherit from APawn so by default they shouldn't.
I have tried to set the respawn mode to "Always respawn" and I've added a SpudGuid, with no success.
The vehicle is saved correctly as the data and the vehicles velocity is being restored on load.
It could be that respawn mode doesn't work on any pawn, but I haven't tried it with anything else, pawns that can be possessed temporarily like vehicles and horses might benefit from being able to set them to respawn after loading a game
The text was updated successfully, but these errors were encountered: