Animated MD3 Door?

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom 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
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Animated MD3 Door?

Post by Enjay »

What would be the best way to make an animated 3D door using a model? I'm thinking, perhaps, something like the doors in Doom3 where a door doesn't just open but has a spinning central lock mechanism of some sort, retracts bolts and then opens. I don't *think* there is explicit support for this in GZDoom.

Animating a model and blocking/unblocking lines with ACS (or just raising lowering a ceiling) is fine but proper door functionality would be even better. I'm thinking that, perhaps, utilising the (Strife-style) animated door feature might work? i.e. creating an animation that is frame-for-frame exactly the same length as the model animation and tying the model animation to the door animation somehow.

I like the fact that animated doors don't try to close while the player is standing in a position that would block the closing. They are proper doors too, so properly block sight/sounds/etc in the way that doors do. I guess the only issue would be ensuring that the model animation stays in step with the door animation (particularly when closing - if the actual door was delayed by something blocking it).

So, would my animated doors idea work - or is there a better way?
boris
Posts: 740
Joined: Tue Jul 15, 2003 3:37 pm

Re: Animated MD3 Door?

Post by boris »

You can use polyobjects and make a model move with them. I made an example map some time ago showcasing one way to do it (see attachment).

They doors in that example are not animated, but since they are still actors it should be possible to make them cycle through an animation when the door opens and closes.
Attachments
polyobjmodeldoor.zip
(33.59 KiB) Downloaded 54 times
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Animated MD3 Door?

Post by Enjay »

That works very nicely indeed. I can certainly use that. Thank you. I can probably do something similar for a vertically opening door too.

I guess the only missing part is "if the player is standing in the way of the door, do not allow it to close" (i.e. something approximating normal door behaviour (particularly animated door behaviour, which is why I wondered if they might be useful)). I could probably set things up so that the door would close when the player crosses a line that is some distance from the door but if there was some sort of automatic handling of closing possible, that would be even better.

What I was really hoping for is something like how Risen3D can handle doors.



In the above video, the grate door and the door beyond it (from the map "Genetic Disaster") are both models. As the video shows, you can't pass through the grate door until it has raised enough (I'm not sure if that's just a timing thing or if it is actually blocking by player height because Risen3D doesn't have player ducking). The grate door doesn't close again but I have played Risen3D maps where the door does wait until the player is out of the way before attempting to close.

The sliding door is also a model and, as the video shows, the player being in the way can affect its behaviour.

I have also played Risen3D maps where doors have more animation - like an unlocking animation of bolts withdrawing etc before the door actually opens - which is the kind of thing that I'd like to go for. Without getting the basic movement sorted out though, there's not much point. Although, as I said, the polyobject example is certainly a method that I could use in many circumstances.
User avatar
Kappes Buur
 
 
Posts: 4120
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: Animated MD3 Door?

Post by Kappes Buur »

Enjay wrote:.... - like an unlocking animation of bolts withdrawing etc before the door actually opens - which is the kind of thing that I'd like to go for. ....
Have a look at Zanieon's MMDCXIV - Journey into the 27 Century
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Animated MD3 Door?

Post by Enjay »

Thanks. That's a very cool map (as I would expect from Zanion).

However, it actually displays the exact problem that I am concerned about. If you open the very first door and then stand in the doorway, after a few seconds, the door will try to close, you get momentarily stuck and you can see inside the model.

What I am trying to find out is if there is a way to avoid the above situation. The reason I wondered about animated doors is because they won't even attempt to close if the player is in the way. So I thought that, maybe, somehow that logic could be applied to doors that are using models for their visuals.
boris
Posts: 740
Joined: Tue Jul 15, 2003 3:37 pm

Re: Animated MD3 Door?

Post by boris »

Check this out: viewtopic.php?f=105&t=69999 It also has an example where the doors only slide close when the player is not near it.

As for the lattice door moving up, the idea is the same: either use an invisible 3D floor or some transfer height action to make it "invisible", then make the model constantly change its position to match the ceiling height of your door sector. You could probably also make the actor act like a door, and move it up when it's activated.
User avatar
Enjay
 
 
Posts: 26534
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Animated MD3 Door?

Post by Enjay »

I'll have to unpick that example because it does look as if it will do a very nice job of overcoming the potential issues with model doors trying to close when the player is in the way. Thank you kindly.
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Animated MD3 Door?

Post by Moebius »

This should resolve my issue/question, also.
I've been working with the polyobjmodeldoor.pk3 for a few hours and can't figure out how the Model is connected to the PolyObject.
How/Where is the Model Actor connected to the specific PolyObj? Is it to the Anchor, StartSpot, StartLine?
boris
Posts: 740
Joined: Tue Jul 15, 2003 3:37 pm

Re: Animated MD3 Door?

Post by boris »

One line of each polyobject has two custom user vars, "user_polyobj_use_start_vertex", which set if the center of the actor is at the start vertex of the line or the end vertex, and "user_polyobj_actor", which is the name of the actor to spawn.

IIRC there's actually a bug in the zscript code, PolyobjectAttachedActor.zs uses the SetXYZ method, but it should use SetOrigin.
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Animated MD3 Door?

Post by Moebius »

1. Not seeing where you use these arguments in your map. What line of the polyobject?
2. I got my models to work visually by removing your Door1 & Door 2 and putting my models (and texture) in as Door 1 & Door2. They're a lot smaller, only 64W x 128H x 4T.
3. When the door opens I can't pass through the opening unless the polyobjects move at least 128 units, then you can walk through. They only need to move 64. My doors need to close so I added a delay and moved the polyobjects back. If I walk towards the backside of the doors I get a little stuck inside the door sometimes.
4. I've always made my polyobjects with single sided lines and the poly anchor inside the void. I see your polyobjects are two-sided, same height as surrounding sector and lines are flagged block player. I tried my way and got error "VM execution aborted: tried to read from address zero." I'm guessing it sees the poly anchor as residing in nothingness or not at all. Can't generate a point of reference.
5. Will keep plugging away on this. Seems like it may still be a solution. Should be so much easier. Attach Actor to PolyObj so it's X, Y, Z displacement equals to PolyObj X, Y, Z displacement.

P.S. I also had to remove Roll = 90 from the Door1.zs Door2.zs files so my doors were oriented correctly. I played around with different values for Roll/Pitch/Angle. Changing Angle doesn't seem to change the Model orientation, at all.
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Animated MD3 Door?

Post by Moebius »

I thought I had finally figured this out, but then I tried to add a second door. It kind of works, except the second door blinks out depending on where you are standing. In my MAP the second door is actually the first one you see. If you walk over to the armor while looking at the door it blinks out. The polyobject is still there and functioning, it's the model of the door that is disappearing.

I'm wondering if it is similar to when you don't make the DECORATE box radius large enough so when it goes off screen but some of the 3D model is still in screen, it blinks out.

Have I misinterpreted your zscript? What is wrong?

https://drive.google.com/file/d/1dDkVaI ... sp=sharing
boris
Posts: 740
Joined: Tue Jul 15, 2003 3:37 pm

Re: Animated MD3 Door?

Post by boris »

As I said in my post the code in PolyobjectAttachedActor.zs uses SetXYZ, which is wrong, as it has to use [wiki]SetOrigin[/wiki].
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Animated MD3 Door?

Post by Moebius »

Thank you for responding so quickly. I guess I missed the Set Origin change. But other than changing SetXYZ to SetOrigin I'm not savvy enough with zscript to know what should follow it for the new position and whether to use true or false.
boris
Posts: 740
Joined: Tue Jul 15, 2003 3:37 pm

Re: Animated MD3 Door?

Post by boris »

false
Moebius
Posts: 56
Joined: Thu Jan 28, 2021 1:45 am

Re: Animated MD3 Door?

Post by Moebius »

Well that really exposes my ignorance of zscript. After changing XYZ to Origin, all I had to do was add ", False". I thought I also would have to figure out a new position.

It's working now. Thank you for tolerating me.
Post Reply

Return to “Mapping”