Does changing a Mesh during runtime work?

Discussions about Coding and Scripting
Post Reply
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Does changing a Mesh during runtime work?

Post by Barbie »

I tried to change the Mesh while a map is loaded:

Code: Select all

function bool CheckReplacement(Actor Other, out byte bSuperRelevant) {
	if (TournamentHealth(Other) != None)
	{
		//Other.Mesh = LodMesh'UnrealShare.Scuba';  <- does not work neither
		Other.Mesh = Mesh'UnrealShare.Scuba';
		log("set mesh for" @ Other $ ", Mesh=" $ Other.Mesh);
	}
	return true;
}
The code is executed properly:
UnrealTournament.log wrote:ScriptLog: set mesh for TestmapV2(SB).HealthPack0, Mesh=UnrealShare.Scuba
ScriptLog: set mesh for TestmapV2(SB).HealthVial0, Mesh=UnrealShare.Scuba
ScriptLog: set mesh for TestmapV2(SB).MedBox0, Mesh=UnrealShare.Scuba
But visually nothing changed. Is it in general not possible to change the mesh while a map is executed?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Does changing a Mesh during runtime work?

Post by Feralidragon »

You can change the Mesh pretty much like almost any other property, and it will generally work.

However, in the case of Inventory actors, the Mesh property will be changed by the actor itself whenever it changes from a map pickup to a held item for example.
In this case, once the inventory actor finishes spawning, it will call BecomePickup and do this: Mesh = PickupViewMesh;.

This means that what you actually need to do in this case is this:

Code: Select all

Inventory(Other).PickupViewMesh = Mesh'UnrealShare.Scuba';
and it should work.
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Does changing a Mesh during runtime work?

Post by sektor2111 »

My private CTFFlagTracker mutator is switching view from sprite to mesh and has no issues.
Kelly was doing some monster morphing itself into others... I don't get why would not be changed... unless you have another mesh in stage.
Perhaps you can have more mesh-variables which can be changed in certain conditions...

NsUTW3 is "altering" "user-defined" Introdudes/IntroBoss/IntroSh!t because they want to run animations which don't exist in meshes used - mapper cannot use another statics because he needs to go at NASA laboratory for that :loool: . After toggling mesh for a few time, mesh is reverted to "user-defined" one leaving map's aspect in original. I have never had issues with meshes at this point and I removed spam logs concerning ZERO animations...
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Does changing a Mesh during runtime work?

Post by Barbie »

Feralidragon wrote: Sun Apr 04, 2021 1:42 amonce the inventory actor finishes spawning, it will call BecomePickup and do this: Mesh = PickupViewMesh;
That was it, thanks. :tu:
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
papercoffee
Godlike
Posts: 10447
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Does changing a Mesh during runtime work?

Post by papercoffee »

Have you ever "played" the map Mansion of Chaos?
viewtopic.php?f=5&t=12402
There are a lot of meshes changed during runtime.
Post Reply