• What are you working on? V10
    2,002 replies, posted
Hey guys, I'm sure a lot of you have dabbled in writing your own simple physics for 2D projects. I'm working on a top-down one right now but I can't for the life of my figure out ( in simple terms ) how to get Angular Velocity of an object based on collision point. Anyone have a code-snippet or tutorial?
Son of a.. I've got a hidden command making one of my variables 1, when it should be 0, making the hunger variable go down faster than it should, this sucks. [editline]05:11AM[/editline] sweet, found it, I hate silly issues like that.
[QUOTE=NorthernGate;22362199]Hey guys, I'm sure a lot of you have dabbled in writing your own simple physics for 2D projects. I'm working on a top-down one right now but I can't for the life of my figure out ( in simple terms ) how to get Angular Velocity of an object based on collision point. Anyone have a code-snippet or tutorial?[/QUOTE] What pisses me off about rotation is that the variable names are hideously long and I can't come up with short ones that would be unambiguous and look good momentOfInertia what the fuck I don't want to write that all the time angularFrequency even worse angularAcceleration fffffffff
angFreq angAccel
momOfI
i see what you did there.
Alternatively you could go the mathematical route (since you're doing a physics engine, you should be able to guess what they are) I dTheta d2Theta [b]Edit[/b] If you remember that you are using A for angle (it's too inobvious: a cheeky comment would help too) dA d2A
[QUOTE=ThePuska;22364353]momentOfInertia what the fuck I don't want to write that all the time[/QUOTE] That's what auto-completion is for. I always have nice descriptive variable names. It makes things a lot nicer when you come back to something after a while.
[QUOTE=KmartSqrl;22364709]That's what auto-completion is for. I always have nice descriptive variable names. It makes things a lot nicer when you come back to something after a while.[/QUOTE] nothing better than coming back to a project and seeing the entire alphabet used as iterators in one function and variables like "fqTRP"
[QUOTE=ThePuska;22364725]nothing better than coming back to a project and seeing the entire alphabet used as iterators in one function and variables like "fqTRP"[/QUOTE] If you have 26 iterators in one function, you're doing it wrong.
[QUOTE=TheBoff;22364704]Alternatively you could go the mathematical route (since you're doing a physics engine, you should be able to guess what they are) I dTheta d2Theta [b]Edit[/b] If you remember that you are using A for angle (it's too inobvious: a cheeky comment would help too) dA d2A[/QUOTE] It's better to have your variable and method names say exactly what they do, rather than needing comments.
[QUOTE=arienh4;22365248]It's better to have your variable and method names say exactly what they do, rather than needing comments.[/QUOTE] I know, but that's only for A, and it's fairly obvious what that does anyway. The mathematical symbol for moment of inertia is I, and the symbol for angle is theta.
Does anyone else here find it awesome to code in really small fonts? [img]http://anyhub.net/file/screenie.png[/img] Doesn't that just look sexy?
I fucking love really small fonts. :dance:
[QUOTE=iPope;22366845]Doesn't that just look sexy?[/QUOTE] no.
[url]http://www.python.org/dev/peps/pep-0008/[/url] Read it, please! I tend to use slightly larger than normal fonts: on linux I keep the gVim default, but use consolata 11 in VS.
Is there any source on the internet describing code generation at runtime? I'd like to try writing a Brainfuck virtual machine by dynamically creating a function in memory for it and run it.
[QUOTE=iPope;22366845]Does anyone else here find it awesome to code in really small fonts? [img_thumb]http://anyhub.net/file/screenie.png[/img_thumb] Doesn't that just look sexy?[/QUOTE] Capitalizing booleans. Not very sexy.
Im working on making maps for team fortress 2 and garry's mod
[QUOTE=Pyrite;22368318]Im working on making maps for team fortress 2 and garry's mod[/QUOTE] [url]http://www.facepunch.com/forumdisplay.php?f=277[/url] That belongs here ^ Mapping is not programming. Modding is. [url]http://www.facepunch.com/forumdisplay.php?f=339[/url] But if you are working on a mod it would go here ^
[QUOTE=Pyrite;22368318]Im working on making maps for team fortress 2 and garry's mod[/QUOTE] wow keep us updated on that
[QUOTE=thelinx;22368284]Capitalizing booleans. Not very sexy.[/QUOTE] That's one of about 2 quirks I can find in python.
[QUOTE=TheBoff;22368580]That's one of about 2 quirks I can find in python.[/QUOTE] Wait, you _have_ to capitalize booleans in python? I feel sorry for all python dudes.
I shant read your silly style guide, not only have I read it before but everyone writes code their own way. I find my way clearer and easy to read, I'm not going to change just because some guys doesn't like it. And anyway apart from the naming conventions there is nothing particularly ugly. [QUOTE=thelinx;22368897]Wait, you _have_ to capitalize booleans in python? I feel sorry for all python dudes.[/QUOTE] Oh yes.
I love everyone thanks for making the programming forum a place I want to be, you are all awesome [editline]11:00PM[/editline] I owuldn't visit facepunch anymore if not for the programming forum
[QUOTE=iPope;22366845]Does anyone else here find it awesome to code in really small fonts? [img]http://anyhub.net/file/screenie.png[/img] Doesn't that just look sexy?[/QUOTE] Looks so manly.
[QUOTE=iPope;22368933]I shant read your silly style guide, not only have I read it before but everyone writes code their own way. I find my way clearer and easy to read, I'm not going to change just because some guys doesn't like it. And anyway apart from the naming conventions there is nothing particularly ugly. Oh yes.[/QUOTE] It's not about ugliness, it's about consistency: it means less stuff to remember when using an API, and it fits into my sense of tidiness. Most publically available python code is built following that, I've found: if it's not I've found that I do a little shudder inside. The again, I don't have a particular problem capitalizing booleans: it looks a bit odd, but I'm a sufficiently skilled typist that pressing the shift key does not particularly impede my progress :smug:
I'm in a dilemma. I have a value in a float value that I want to output. Except drawtext doesn't allow float values. Only strings. And making my string equal the float value gives gibberish.
[QUOTE=NorthernGate;22362199]Hey guys, I'm sure a lot of you have dabbled in writing your own simple physics for 2D projects. I'm working on a top-down one right now but I can't for the life of my figure out ( in simple terms ) how to get Angular Velocity of an object based on collision point. Anyone have a code-snippet or tutorial?[/QUOTE] Maybe its a bit much for what your doing but this tutorial helped me out. [url]http://www.gamedev.net/reference/programming/features/verletPhys/[/url]
Guys I have a math problem. I have a variable that needs to decrease by 1 every second so I used var -= FrameTime That works fine because if the framerate is faster, it will decrease less and still decrease by 1 every second. But then I have another variable that needs to devide by 2 every second and I have no idea how to do it. I have tried something like var /= 1.001F * FrameTime That obviously doesn't work because if the FrameTime is bellow 1 it will actually increase the variable. Help please.
Sorry, you need to Log In to post a reply to this thread.