The only way to find the vertices is to check all linedefs belonging to a sector and look at their vertices. What are you trying to do here?Major Cooke wrote:Well, in particular, finding the vertices is what I'm after. I think I can handle the rest, and they're all triangles. What function can I use to find them?
"How do I ZScript?"
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!)
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!)
-
- Lead GZDoom+Raze Developer
- Posts: 49141
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript-only "How do I..." thread
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript-only "How do I..." thread
I'm trying to roll sprites along a slope like this. (This is from Darwinia)
-
- Lead GZDoom+Raze Developer
- Posts: 49141
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript-only "How do I..." thread
Ugh.
No idea how to express that in yaw/pitch/roll...
No idea how to express that in yaw/pitch/roll...
-
- Posts: 13727
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: ZScript-only "How do I..." thread
This may be a bit hacky but it's the easiest way I know of to do this: (and please don't ask me for the code, you know ZScript better than I do so you're on your own)
Each actor has two "check" actors that they spawn as children. One that's one pixel ahead, and one that's one pixel to the side. These checks are relative to the main actor's yaw, so if the actor rotates it rotates along with it. These check actors have the +FLOORHUGGER property in order to be in an absolute position on the floor.
Since these checks are only one pixel offset, it's pretty easy to just get the arctangents:
For the ahead actor, do arctan(me.zheight-check1.zheight) - that's your forward facing angle.
For the side actor, do arctan(me.zheight-check2.zheight) - that's your roll.
Multiply the angles by *-1 if they do not look right.
Each actor has two "check" actors that they spawn as children. One that's one pixel ahead, and one that's one pixel to the side. These checks are relative to the main actor's yaw, so if the actor rotates it rotates along with it. These check actors have the +FLOORHUGGER property in order to be in an absolute position on the floor.
Since these checks are only one pixel offset, it's pretty easy to just get the arctangents:
For the ahead actor, do arctan(me.zheight-check1.zheight) - that's your forward facing angle.
For the side actor, do arctan(me.zheight-check2.zheight) - that's your roll.
Multiply the angles by *-1 if they do not look right.
-
- Lead GZDoom+Raze Developer
- Posts: 49141
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript-only "How do I..." thread
The proper way should of course be to read the current floor's normal and transform it into a set of angles. It's just that I do not know the math for that.
-
- Posts: 13727
- Joined: Tue Jan 13, 2004 1:31 pm
- Preferred Pronouns: She/Her
Re: ZScript-only "How do I..." thread
I got as far as College Algebra in math. Beyond that, I cannot help you.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript-only "How do I..." thread
And I just remembered I own the darwinia source code. The rendering is done via a Matrix34 (it uses OpenGL as well), looking more into the details on that...Graf Zahl wrote:Ugh.
No idea how to express that in yaw/pitch/roll...
In the mean time, doesn't bouncing have some manner of recalculating which direction to go? Maybe I could use that...
I can handle the yaw/pitch/roll myself, I just need to find out how steep it can dip, and at what angle. That's why I'm trying to get all three vertices.
-
- Lead GZDoom+Raze Developer
- Posts: 49141
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript-only "How do I..." thread
Bouncing just uses the plane normal with a few multiplications. The problem you are facing is different: Finding what you need to set the angles to to get the desired orientation,
-
-
- Posts: 1355
- Joined: Mon May 06, 2013 8:02 am
Re: ZScript-only "How do I..." thread
Correct me if I'm wrong, but wouldn't it be better to measure the height at each corner of the actor and calculate the normal between those points, allowing you to smoothly angle the sprite over sharp edges rather than snapping instantly while also allowing you to angle the sprite on stairs if you so wish?
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript-only "How do I..." thread
I feel like this is where Trace could be of use in a way...
Anyway I did some digging into the Darwinia source code. I wouldn't be surprised if it's not of any help.
Anyway I did some digging into the Darwinia source code. I wouldn't be surprised if it's not of any help.
Spoiler: How Darwinia grabs Z (used for calculating speeds)
Spoiler: Some rendering setup
Spoiler: Some vector functions@kodi unfortunately I've tried doing a bunch of hacks to find lower and upper places where things consider floorz at but unfortunately, I've had no luck.
-
- Posts: 269
- Joined: Tue Jan 19, 2010 5:07 pm
Re: ZScript-only "How do I..." thread
How can I change A_SkullAttack so that Lost Souls will not hurt themselves when charging?
-
- Lead GZDoom+Raze Developer
- Posts: 49141
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: ZScript-only "How do I..." thread
You can't. A_SkullAttack only adds some velocity to the Lost Soul.
The only option you have is to override the virtual Slam method in ZScript in a child class.
The only option you have is to override the virtual Slam method in ZScript in a child class.
-
- Posts: 269
- Joined: Tue Jan 19, 2010 5:07 pm
Re: ZScript-only "How do I..." thread
Graf Zahl wrote:You can't. A_SkullAttack only adds some velocity to the Lost Soul.
The only option you have is to override the virtual Slam method in ZScript in a child class.
Code: Select all
override bool Slam(Actor victim)
{
if (victim.GetSpecies() == self.GetSpecies())
return false;
Super.Slam(victim);
return false;
}
-
- Posts: 265
- Joined: Wed Mar 28, 2012 2:27 am
Re: ZScript-only "How do I..." thread
I know I've asked this before, but I couldn't really figure out how to go about this. I'm trying to get a smooth player-animation for my 2D platform-game, because ever since I converted my DECORATE code to ZScript the player's animation has been looking very choppy. Major Cooke replied to this question before, but I couldn't figure out where to go from there. Can anyone explain to me what I need to do fix this?
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: ZScript-only "How do I..." thread
Try pming zombiekiller about it directly. I don't have the file anymore myself.