Zscript PhysX/Havok/Bullet

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
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Zscript PhysX/Havok/Bullet

Post by Apeirogon »

I wish bring in gzdoom some basic mechanics from first several pages of any textbook of physic, like inertia, impulse, ground/water/air friction, etc.

For this I need add to engine concept of force or acceleration.

But before adaptation of vectors analysis for zscript, I want to know is there are workaround in zscript that I can use for this?
User avatar
Rachael
Posts: 13562
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Zscript PhysX/Havok/Bullet

Post by Rachael »

It's quite unlikely that you'll ever be able to bring "true physics" to the Doom engine, but that being said, all objects have a concept of mass and velocity, and a simple multiplication of those is your total force in a given direction.

Inertia is simply a colliding object's mass - if you remember Newton's third law, where every action must have an equal and opposite reaction, that simply means that colliding with another object will basically swap momentums - providing the collision is head-on. It gets a little more complicated when it's a grazing and not a head-on collision - then it involves friction, and extra stuff like that, which gets a lot more complicated.

Everything in physics can be expressed mathematically, as long as you remember Newton's laws.
User avatar
Gutawer
Posts: 469
Joined: Sat Apr 16, 2016 6:01 am
Preferred Pronouns: She/Her

Re: Zscript PhysX/Havok/Bullet

Post by Gutawer »

Rachael wrote:but that being said, all objects have a concept of mass and velocity, and a simple multiplication of those is your total force in a given direction.
Force is equal to mass * acceleration, not mass * velocity - that's momentum. An object with constant velocity has no forces acting on it - that's Newton's first law.
User avatar
Rachael
Posts: 13562
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Zscript PhysX/Havok/Bullet

Post by Rachael »

True, thanks for clearing that up.
Kotti
Posts: 86
Joined: Tue Dec 27, 2016 4:08 am

Re: Zscript PhysX/Havok/Bullet

Post by Kotti »

Gutawer wrote:not mass * velocity - that's momentum.
Not according to vanilla Doom "physics"... :mrgreen:
Post Reply

Return to “Scripting”