PDA

View Full Version : [GMOD] Some crazy math



Bastinka
July 19th, 2009, 10:23 PM
Been messing around with Expression 2 Chips (Garrysmod)

I'm not a math wiz, or anything of the sort, but has anyone got the slightest clue of how I would calculate and objects landing location (if it's in the air) using some crazy math?

I'd imagine I'd have to use it's inertia, mass, velocity, bearing, elevation, direction and position. All I would want to know is when it's position vector his ~0 on the Z axis, where it would be (Before it lands).


Example: I stick the chip on a prop in Garrysmod, then throw it in the air with my physgun.

CodeBrain
July 19th, 2009, 10:30 PM
Hey Silent, for future reference, post Garry's Mod related threads here:

http://www.modacity.net/forums/forumdisplay.php?f=57

Anyway, your question could be solved using GPS (Which is in the E2 chip already)

Shouldnt be that difficult

RedBaron
July 19th, 2009, 10:56 PM
X = X0 + 1/2(V0 + V)t

Where:
X = final position
X0 = initial position
V = final velocity
V0 = initial velocity
t = elapsed time

Relative to only one frame of reference, you'll have to break 3D vectors into its individual components, use those values, then recompile the final vectors. This disregards friction, which will require a whole different set of equations. You're probably better off not doing it manually.

Syuusuke
July 19th, 2009, 10:56 PM
Basically physics.

E: Yes, what Delta said, but wouldn't you have to account for the angle you launched your doohicky? (I'm assuming you're not shooting it off..oh say straight off a cliff or something)

Phopojijo
July 19th, 2009, 11:00 PM
Yeah, Inertia and Bearing don't belong on that list... elevation either if you consider position to be 3-dimensional.

RedBaron
July 19th, 2009, 11:02 PM
Basically physics.

E: Yes, what Delta said, but wouldn't you have to account for the angle you launched your doohicky? (I'm assuming you're not shooting it off..oh say straight off a cliff or something)
Initial angle of the vector falls under finding the individual components (via your basic trigonometry), so yes.

Bastinka
July 19th, 2009, 11:25 PM
The way you did it delta, I would need to know what the ending velocity and starting is. That isn't what I'm trying to do. I need to calculate an objects landing position relative to its current position, acceleration and whatnot.

I got my answer on another forum: http://www.wiremod.com/forum/help-support/12326-e2-finding-moving-objects-stopping-position.html

Thanks though!

legionaire45
July 20th, 2009, 01:49 AM
Fizz (http://www.modacity.net/forums/showpost.php?p=383758&postcount=4)
Icks (http://www.modacity.net/forums/showpost.php?p=383714&postcount=2)