Zscript - Getting no map collision detection on actors

Ask about ACS, DECORATE, ZScript, or any other scripting questions 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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Valencer
Posts: 22
Joined: Wed Mar 28, 2018 6:58 am

Zscript - Getting no map collision detection on actors

Post by Valencer »

Hey all!

I was wondering if there was a way to make an actors ignore sectors and/or Z height.

My purpose for this is to do some cool stuff with actors, having them move in and other of walls to create some cool effects or uses.
I want to have the actor still able to interact with other actors, but NOT the map.

When I use ZScript's SetOrigin, the Z component seems to not be absolute, so if I was to move an actor across rooms or multiple sectors, it will either 'dip' downwards, raise unexpectedly or completely disappear.

The NOINTERACTION flag seemed to be the closest thing to what I need. Actors will move direct and straight without any Z change. However it removes ALL collisions, so this includes collisions with other actors and players, which is not what I want.

I hope that there is a Actor flag (If it was that easy) or a method that could fix this!

Many Thanks,
Valencer
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: Zscript - Getting no map collision detection on actors

Post by Arctangent »

SetOrigin's z parameter is in fact absolute, what you're running into is the fact that the idtech 1 engine's physics constrain actors to within the boundaries of a sector. NOINTERACTION excludes actors from these physics, thus why actors with it can break this rule.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Zscript - Getting no map collision detection on actors

Post by Matt »

I can imagine doing a Tick() replacement that gets exactly what you want, but it'll be really specific and complex and in all likelihood not at all optimized so hopefully there'll be fewer than ~100 of them at any given moment...
Valencer
Posts: 22
Joined: Wed Mar 28, 2018 6:58 am

Re: Zscript - Getting no map collision detection on actors

Post by Valencer »

@Arctangent
Interesting. I found that it gets extra weird when working around complex and lots of small sectors. So my work around has been to let out a nice big flat sector in the wall where I know the actor will be moving.

@Matt
I tried some stuff where I tried to modify the actors Z directly and calculate an offset to counter any movement, but anything I tried did not seem to work. I think what Arctangent mentioned may have something to do with it, as a GetZAt function (For example) may report the Z to be something, but it may actually be something different in 3D space.
Is that what you meant by TIck() replacement? Please let me know if I am wrong.

---

Ill have to try and go forward with the work-arounds!

Many Thanks,
Valencer
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Zscript - Getting no map collision detection on actors

Post by Matt »

My understanding is that the actor's built-in Tick() function contains a check to see if the actor is "out of bounds" relative to the floor and ceiling of the sector it's in. When I override it, I get no such problems, but if I don't, actors tend to "snap" back into the "right" place.

The problem with overriding Tick() is that you're going to have to replicate all actor collision and movement that would normally already be handled for you. It's the sort of thing you could spend five or six rather aggravating weekends on to get right and cover all the weird edge cases you wouldn't have thought of before they happen.
Post Reply

Return to “Scripting”