Parameters for 3D Models

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
Daryn
Posts: 122
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Parameters for 3D Models

Post by Daryn »

Hey all!

In the project we're working on, we'll be using some 3D models as props.

Is it possible to pass properties like Scale, Zoffset, etc into the modeldef for that model dynamically?

Thanks.
User avatar
Cherno
Posts: 1318
Joined: Tue Dec 06, 2016 11:25 am

Re: Parameters for 3D Models

Post by Cherno »

What do you mean by "dynamically"?

https://zdoom.org/wiki/MODELDEF
User avatar
Daryn
Posts: 122
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Re: Parameters for 3D Models

Post by Daryn »

Well, I can define models just fine, but the issue is that I have to set the ZOffset for them in the modeldef on a model by model basis. Trying to do so in GZDoom Builder has no effect in game. So if I want to use the same model at different heights, for instance, I have to create multiple instances of each model. The rotation and scale of the model do work from GZDoom Builder, but Zoffset, Pitch, and Roll don't do anything.

I've read through the modeldef wiki page before posting this, there's no mention of this in there.

So I'm kind of at a loss. I mean I can do multiple instances, but that's not a very effecient way of doing things.

Is there something I'm missing?
User avatar
Cherno
Posts: 1318
Joined: Tue Dec 06, 2016 11:25 am

Re: Parameters for 3D Models

Post by Cherno »

Well, if you could give the DECORATE or zScript actor a user variable storing the z height, and then in Spawn put it at this height relative to the floor. this would at least work for completely static actors that can't be thrusted and are not affected by gravity. for such cases, more complex workarounds are needed (such as overriding Tics()).
User avatar
Daryn
Posts: 122
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Re: Parameters for 3D Models

Post by Daryn »

Hmm... That's an interesting workaround. I'll pull up the wiki and try to get that to work when I have the headspace for it again. I'll post back if I run into trouble.
User avatar
Daryn
Posts: 122
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Re: Parameters for 3D Models

Post by Daryn »

Okay, so if I understand this right, I'd set a user variable in my actor properties, like this, maybe.

Code: Select all

// Ceiling Fan
Actor CeilingFan 30042 {
	//$Category "Props"
	//$Title "Ceiling Fan"
	Height 16
	Radius 16
	-SOLID
	
	var int user_height;
	
	States 
	{
		Spawn:
		CFAN A 1
		Loop
	}
}
How would I get that value to the modeldef for that actor? I'd need to have GZDB Map a Thing's ZHeight to that variable, then send send that to the modeldef's ZOffset property. Is this weird GZDB's custom user fields come in?
User avatar
Cherno
Posts: 1318
Joined: Tue Dec 06, 2016 11:25 am

Re: Parameters for 3D Models

Post by Cherno »

You can not do that. What I meant was to use the variable to put the actual actor (no matter the model's zoffset) at a certain height. But now that I think about it... You could just as easily put the actor directly at the required height in GZDB.
User avatar
Daryn
Posts: 122
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Re: Parameters for 3D Models

Post by Daryn »

Sadly, I can't do that. Whatever height I set the actor to in GZDB i ignored by the model when GZDoom runs. I know the height is getting passed since if I comment the modeldef out I get the sprite at the desired height.

I don't know if this is a bug or if I'm just missing something.
User avatar
Daryn
Posts: 122
Joined: Wed Jan 23, 2019 10:22 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11 Professional X64
Graphics Processor: nVidia with Vulkan support

Re: Parameters for 3D Models

Post by Daryn »

For anyone that wants to know. The solution is to not set ZOffset in the modeldef, but to add the +SPAWNCEILING and +NOGRAVITY properties to the actor.

Return to “Assets (and other stuff)”