Page 1 of 1

Pitch and Roll - how?

PostPosted: Tue Aug 13, 2019 2:55 pm
by Enjay
I notice in the GZDB UDMF tings dialogue that there are options to set the pitch and roll of an actor.

The problem is, I can't seem to get any placed actors to appear any different regardless of how I set these. The actors concerned are just very simple 1 frame static actors with models attached. What do I need to do to get the actor to appear differently when they spawn? Are there some flags I'm missing or something? I know it must work because I've seen other people saying they have used the feature.

Re: Pitch and Roll - how?

PostPosted: Tue Aug 13, 2019 5:58 pm
by AFADoomer
Model-based actors have to have USEACTORPITCH and/or USEACTORROLL specified in MODELDEF.

If your actors were sprite-based, the actor class would have to be flagged with +FLATSPRITE to be affected by pitch, and +ROLLSPRITE to be affected by roll.

Re: Pitch and Roll - how?

PostPosted: Tue Aug 13, 2019 6:47 pm
by Enjay
Perfect! That's exactly the information I needed. I've got it working now. :)

Re: Pitch and Roll - how?

PostPosted: Wed Aug 14, 2019 3:25 am
by Enjay
It's worth pointing out that, quite often, a model that is set to work well in its normal orientation will not work as well when pitched/rolled.

Image

However, in this particular instance, the fix was easy enough. UDMF allows individual objects to have their gravity changed (in the Action/Tag/Misc tab of the GZDB things editor). The chairs are non-blocking so all I had to do was set gravity to 0 and move their z position up a few units.

Image


[edit]Hmmm, I wonder if changing "Rotation-Center" would also address this? Need to check...[/edit]
[edit2]Nah, it wasn't particularly useful (in this case anyway).[/edit2]

Re: Pitch and Roll - how?

PostPosted: Wed Aug 14, 2019 6:31 am
by Enjay
Perhaps related, perhaps not...

Is there any way in GZDoom for actors to be set to automatically align with the plane that they are standing on. Risen3D has this ability and while this screenshot may be a bit amusing in the way it looks, it does show the principle (BTW, these guys were vertically oriented until I killed them):



So, is there an actor/modeldef flag that allows this (can't see one) or would any actors need their pitch/roll set manually instead? I'm mainly thinking about static decorations that would be placed on a slope and stay there.

Re: Pitch and Roll - how?

PostPosted: Wed Aug 14, 2019 8:25 am
by Caligari87
There's no built-in option that I know of, but a few people have accomplished this by using z-checks / line traces at the corners of the actor's bounding box to set pitch / roll / angle appropriately. I think BoA uses it for tanks, for example.

8-)

Re: Pitch and Roll - how?

PostPosted: Wed Aug 14, 2019 11:42 am
by Enjay
Caligari87 wrote:I think BoA uses it for tanks, for example.

I've checked out the repository and there does indeed seem to be something in the zscript that handles this. Too complicated for me to make much sense of though because it's all wrapped up in other stuff to do with tank movement. I'd only need if for a static item, but I'd struggle to isolate only the bits of code that I need.

Re: Pitch and Roll - how?

PostPosted: Sun Sep 08, 2019 12:07 pm
by AFADoomer
Sorry to bump...

@Enjay - What you are looking for is the SetPitchRoll function here. You probably also will need to delete line 21, but I'm pretty sure everything should work out of the box as-is - If the actor won't ever move, just call the function once in PostBeginPlay(), otherwise you can call it in Tick() for continuous updating, or once in the Death state if you want to emulate your example above.