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.
Parameters for 3D Models
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.
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.
-
- Posts: 123
- 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
-
- Posts: 1320
- Joined: Tue Dec 06, 2016 11:25 am
-
- Posts: 123
- 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
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?
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?
-
- Posts: 1320
- Joined: Tue Dec 06, 2016 11:25 am
Re: Parameters for 3D Models
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()).
-
- Posts: 123
- 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
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.
-
- Posts: 123
- 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
Okay, so if I understand this right, I'd set a user variable in my actor properties, like this, maybe.
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?
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
}
}
-
- Posts: 1320
- Joined: Tue Dec 06, 2016 11:25 am
Re: Parameters for 3D Models
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.
-
- Posts: 123
- 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
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.
I don't know if this is a bug or if I'm just missing something.
-
- Posts: 123
- 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
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.