LeFix Posted April 18, 2017 Share Posted April 18, 2017 (edited) English: I want to add a specific physics model as accurate as possible to the game for my new mod. (FPV drone racing/quadcopter sim)It has to be clearly defined (mathematically) and therfore comparable.Reasons why I can't calcualte the physics seperate from the game engine: There's no possibility to set the rotational speed of an object (I guess it's possible with the correct memory address however this is uneccesary if I can solve the other problems) The collisions only can be properly calculated by the game engine (Currently my mod uses a dynamic and a static object to be able to have proper collisions despite an external calcualtion of the physics) Only under the premise of an internal calculation the objects behavior is coherent to the objects. (Independent from framerate, lags) The perfomance surely is better when exsting functions are used instead of partially redefining them in my own code and accesing the state of the object. Possibilites we have:The existing(default) forces of the game engine (gravitation, drag, ...?) can be deactivated can be modified (quadcopter object only!) are cleary defined and can be corrected by additional forces Furthermore, following informations on a object have to be known and/or modifiable: mass drag coefficient (if the ingame drag can't be disabled) moment of inertia (Matrix, hopefully only a multiple of the unit matrix) Collision behavior (elastic/plastic) Already solved: Gravity can be disabled on specific objects (easy)-> My aim is to reduce the physical interface between script and engine to forces and momentums which act on objects. Don't modfiy the state of the object (Position, Velocity, Rotation) As long as I don't have detailed information on these things, the pyhsics of my mod are limited at a quite low level of realism.I appreciate any hints and information! (The physics model itself is not part of this discussion and at this point its detailed enough, the implementation is the problem) Since I'm german and there are quite alot german-speaking modders I wrote the same text in german as well. German:Ich möchte ein Physikmodell so genau wie möglich in das Spiel integrieren, für meine Mod. (FPV Drone Racing/Quadcopter Sim)Es muss eindeutig definiert (mathematisch) sein und somit auch vergleichbar.Gründe warum ich die Physik nicht unabhängig von der Game Engine berechnen kann:-Es gibt keine Möglichkeit die Rotationsgeschwindigkeit eines Objekts festzulegen (vermutlich schon über die passende Speicheradresse aber es ist trotzdem nicht wirklich zielführend)-Kollisionen können nur innerhalb der Game Engine effizient berechnet werden (Aktuell nutzt meine Mod ein dynamisches und ein statisches Objekt um trotz externer Physik Berechnung eine realistische Interaktion mit der Umgebung zu ermöglichen.)-Das Verhalten des Objekts ist nur dann kohärent zu den anderen dynamischen Objekten, wenn alle innerhalb der Engine berechnet werden. (Kein Einfluss der Framerate, druch Lags etc.)-Die Gesamtperformance ist sicherlich besser, als wenn von außen auf den Zustand des Objekts zugegriffen wird.Möglichkeiten die sich meines Erachtens ergeben:Die bestehenden Kräfte (der Game Engine: Gravitation, Reibung, ...?) lassen sich deaktivieren lassen sich modifizieren sind eindeutig bestimmbar und somit korregierbar indem angepasste externe Kräfte miteinfließen Des Weiteren muss das Physikobjekt bekannt sein: Masse Widerstandsbeiwert (sofern die default Luftreibung nicht deaktiviert werden kann) Drehträgheiten (Matrix, hoffentlich nur vielfaches der Einheitsmatrix sprich "Kugel") Stossverhalten (elastisch/plastisch) Bereits gelöst/bestimmt: Gravition lässt sich bei einzelen Objekten deaktivieren (einfach)-> Schlussendlich will ich den physikalischen Einfluss des Skripts auf die Einführungen von Kräften und Momenten reduzieren und den Rest der Game Engine überlassen. (Also die Position noch Geschwindigkeit von außen ändern; sprich alle Zustandsvariablen) Solange ich nicht die notwendigen Information habe ist die Physik der Mod unweigerlich auf ein geringes Maß an Realismus beschränkt.Jegliche Information zu einem der genannten Punkte ist erwünscht! Links: http://www.dev-c.com/nativedb/ https://www.gta5-mods.com/scripts/fpv-drone-racing https://github.com/crosire/scripthookvdotnet/tree/dev_v3/source Edited April 18, 2017 by LeFix ikt 1 Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/ Share on other sites More sharing options...
CamxxCore Posted April 19, 2017 Share Posted April 19, 2017 (edited) English: I want to add a specific physics model as accurate as possible to the game for my new mod. (FPV drone racing/quadcopter sim) It has to be clearly defined (mathematically) and therfore comparable. Reasons why I can't calcualte the physics seperate from the game engine: There's no possibility to set the rotational speed of an object (I guess it's possible with the correct memory address however this is uneccesary if I can solve the other problems) The collisions only can be properly calculated by the game engine (Currently my mod uses a dynamic and a static object to be able to have proper collisions despite an external calcualtion of the physics) Only under the premise of an internal calculation the objects behavior is coherent to the objects. (Independent from framerate, lags) The perfomance surely is better when exsting functions are used instead of partially redefining them in my own code and accesing the state of the object. Possibilites we have:The existing(default) forces of the game engine (gravitation, drag, ...?) can be deactivated can be modified (quadcopter object only!) are cleary defined and can be corrected by additional forces Furthermore, following informations on a object have to be known and/or modifiable: mass drag coefficient (if the ingame drag can't be disabled) moment of inertia (Matrix, hopefully only a multiple of the unit matrix) Collision behavior (elastic/plastic) Already solved: Gravity can be disabled on specific objects (easy)-> My aim is to reduce the physical interface between script and engine to forces and momentums which act on objects. Don't modfiy the state of the object (Position, Velocity, Rotation)As long as I don't have detailed information on these things, the pyhsics of my mod are limited at a quite low level of realism. I appreciate any hints and information! (The physics model itself is not part of this discussion and at this point its detailed enough, the implementation is the problem) Since I'm german and there are quite alot german-speaking modders I wrote the same text in german as well. German: Ich möchte ein Physikmodell so genau wie möglich in das Spiel integrieren, für meine Mod. (FPV Drone Racing/Quadcopter Sim) Es muss eindeutig definiert (mathematisch) sein und somit auch vergleichbar. Gründe warum ich die Physik nicht unabhängig von der Game Engine berechnen kann: -Es gibt keine Möglichkeit die Rotationsgeschwindigkeit eines Objekts festzulegen (vermutlich schon über die passende Speicheradresse aber es ist trotzdem nicht wirklich zielführend) -Kollisionen können nur innerhalb der Game Engine effizient berechnet werden (Aktuell nutzt meine Mod ein dynamisches und ein statisches Objekt um trotz externer Physik Berechnung eine realistische Interaktion mit der Umgebung zu ermöglichen.) -Das Verhalten des Objekts ist nur dann kohärent zu den anderen dynamischen Objekten, wenn alle innerhalb der Engine berechnet werden. (Kein Einfluss der Framerate, druch Lags etc.) -Die Gesamtperformance ist sicherlich besser, als wenn von außen auf den Zustand des Objekts zugegriffen wird. Möglichkeiten die sich meines Erachtens ergeben: Die bestehenden Kräfte (der Game Engine: Gravitation, Reibung, ...?) lassen sich deaktivieren lassen sich modifizieren sind eindeutig bestimmbar und somit korregierbar indem angepasste externe Kräfte miteinfließen Des Weiteren muss das Physikobjekt bekannt sein: Masse Widerstandsbeiwert (sofern die default Luftreibung nicht deaktiviert werden kann) Drehträgheiten (Matrix, hoffentlich nur vielfaches der Einheitsmatrix sprich "Kugel") Stossverhalten (elastisch/plastisch) Bereits gelöst/bestimmt: Gravition lässt sich bei einzelen Objekten deaktivieren (einfach)-> Schlussendlich will ich den physikalischen Einfluss des Skripts auf die Einführungen von Kräften und Momenten reduzieren und den Rest der Game Engine überlassen. (Also die Position noch Geschwindigkeit von außen ändern; sprich alle Zustandsvariablen)Solange ich nicht die notwendigen Information habe ist die Physik der Mod unweigerlich auf ein geringes Maß an Realismus beschränkt. Jegliche Information zu einem der genannten Punkte ist erwünscht! Links: http://www.dev-c.com/nativedb/ https://www.gta5-mods.com/scripts/fpv-drone-racing https://github.com/crosire/scripthookvdotnet/tree/dev_v3/source Take a look at the native 'SET_OBJECT_PHYSICS_PARAMS'. It lets you adjust drag, mass among other things. For example, I used in my flares script to adjust the trajectory when the flares are launched away from the vehicle: https://github.com/CamxxCore/AirSuperiority2/blob/master/ScriptBase/Extensions/IRFlareManager.cs#L428 Edited April 19, 2017 by CamxxCore LeFix, ikt and jedijosh920 3 Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069526963 Share on other sites More sharing options...
LeFix Posted April 21, 2017 Author Share Posted April 21, 2017 (edited) @CamxxCore Thanks for your response. I don't know how I could miss this method until now. The number of arguments seems to be good. I guess most (hopefully all) params which I want to adjust can be accessed with it. Just one question, you said it's possible to adjust the drag, but in the current description it doesn't appear. Do you know more about the parameters than what's written in the description? p2 1.2 p5 0.0109f From http://www.dev-c.com/nativedb/func/info/f6df6e90de7df90fOBJECT::SET_OBJECT_PHYSICS_PARAMSHashes: 0xF6DF6E90DE7DF90F 0xE8D11C58void SET_OBJECT_PHYSICS_PARAMS(Object object, float weight, float p2, float p3, float p4, float p5, float gravity, float p7, float p8, float p9, float p10, float buoyancy)// 0xF6DF6E90DE7DF90F 0xE8D11C58Adjust the physics parameters of a prop, or otherwise known as "object". This is useful for simulated gravity.Other parameters seem to be unknown.- Solla From https://github.com/CamxxCore/AirSuperiority2/blob/master/ScriptBase/Extensions/IRFlareManager.cs#L428 Function.Call(Hash.SET_OBJECT_PHYSICS_PARAMS, flare.Handle, -1.0f, 1.2f, -1.0f, -1.0f, 0.010988f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f); Edited April 22, 2017 by LeFix Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069529906 Share on other sites More sharing options...
CamxxCore Posted April 23, 2017 Share Posted April 23, 2017 (edited) @CamxxCore Thanks for your response. I don't know how I could miss this method until now. The number of arguments seems to be good. I guess most (hopefully all) params which I want to adjust can be accessed with it. Just one question, you said it's possible to adjust the drag, but in the current description it doesn't appear. Do you know more about the parameters than what's written in the description? p2 1.2 p5 0.0109f From http://www.dev-c.com/nativedb/func/info/f6df6e90de7df90f OBJECT::SET_OBJECT_PHYSICS_PARAMSHashes: 0xF6DF6E90DE7DF90F 0xE8D11C58void SET_OBJECT_PHYSICS_PARAMS(Object object, float weight, float p2, float p3, float p4, float p5, float gravity, float p7, float p8, float p9, float p10, float buoyancy)// 0xF6DF6E90DE7DF90F 0xE8D11C58Adjust the physics parameters of a prop, or otherwise known as "object". This is useful for simulated gravity.Other parameters seem to be unknown.- SollaFrom https://github.com/CamxxCore/AirSuperiority2/blob/master/ScriptBase/Extensions/IRFlareManager.cs#L428 Function.Call(Hash.SET_OBJECT_PHYSICS_PARAMS, flare.Handle, -1.0f, 1.2f, -1.0f, -1.0f, 0.010988f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f); From what I could tell p5 is related to drag and p4 seems to be related to momentum. p6 also seems momentum- related (maybe glide?) Edit: I see it's labeled as gravity so I'll assume it's right. Edited April 23, 2017 by CamxxCore Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069533679 Share on other sites More sharing options...
LeFix Posted April 24, 2017 Author Share Posted April 24, 2017 @CamxxCore Then I'll try to determine all the parameters and update the description soon. NModds 1 Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069535378 Share on other sites More sharing options...
sollaholla Posted May 8, 2017 Share Posted May 8, 2017 Any advancement on this? I could really use more information. NModds 1 Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069560204 Share on other sites More sharing options...
NModds Posted May 11, 2017 Share Posted May 11, 2017 It would be awesome if you post your new findings here. http://www.dev-c.com/nativedb gets reset after some time. Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069566328 Share on other sites More sharing options...
LeFix Posted May 14, 2017 Author Share Posted May 14, 2017 (edited) I just started to analyse the parameters. p1 is mass, any positive number (>0) seems to work p2 is (relative?) gravity, any number (>=0) works, default is 1.0f p3 - p5 are isotrop drag coefficients, which have different effects at the same value. I assume they are some sort of polynomial coefficients, e.g. p5 is definetely some drag with higher polynomial degree than p4, important for me: They all can be disabled/set to 0.0, so there are no drag forces at all! (And I can introduce my own drag with additional forces) p6 - p8 are isotrop rotation drag coefficients (different polynomial degree as well I assume) p9 Unkown Manipulating this value didn't change something. Tried buyoancy, drag, rotation drag, friction, crash behavior (some objects bounce back by default, thought one of settings might change this) p10 Seems to be something like the reciprocal of the moment of inertia. With high values objects spin faster after shooting them or after falling on the floor, if they spin really fast their go into a steady roation around a body-fixed axis, so I guess there are some different momentums of inertia for the different main axes even though they can't be accessed using this method. (e.g. a object like a pen will tend to spin like a drill instead of a like a helicopter, after get shot in the game) Edit: (15.05.17) It actually is the maximum rotation velocity! It doesn't really change the physics of the object but limits the influence of momentums. Two identical objects (with different caps) behave similiar below this rotation velocity. Any momentum which would increase it above the limit will be ignored. Values <=1.0f are not accepted. 1.00...01 is the smallest possible value. The unit is rad/s, this means 6.28(=2*pi) will limit the rotation velocity to one revolution per second. p11 is the density (in former descriptions called buoyancy but imo density makes more sense) I also checked the actual gravitational acceleration value, after one second the objects velocity in z direction has a delta of -10.0 units/s or m/s. It's not 9.81... That's it. When I have some time for modding again, I will try to figure out some more details and how I can use these informations to improve my drone mod. Note: Some translations (from german) of technical/physical expressions may be inappropriate , so please ask or correct me if something sounds weird. Edited May 15, 2017 by LeFix NModds and sollaholla 2 Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069571844 Share on other sites More sharing options...
LeFix Posted May 15, 2017 Author Share Posted May 15, 2017 (edited) The descriptions of ENTITY::APPLY_FORCE_TO_ENTITY which I could find, are wrong and misleading. I cannot be the first one who notices that bad documentation about these methods (native db, scripthookdotnet,..) Edit: Created a new thread about these functions http://gtaforums.com/topic/887362-apply-forces-and-momentums-to-entityobject/ Edited May 15, 2017 by LeFix Link to comment https://gtaforums.com/topic/885669-precisely-define-object-physics/#findComment-1069572792 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now