• What do you need help with? V4 (January 2012)
    966 replies, posted
[QUOTE=DSG;34626702]-ansi -Wall -pedantic are my required compiling commands, and it's C90, not C99, and I'm doing it in CodeBlocks. However, even when I try compiling with std=c99 instead of -ansi (which is C90) it'll compile, but not run properly at all. I'll just get a blank terminal window that doesn't print anything and doesn't seem to take any input or output anything as a result. Also, my teacher told us to use fgets for strings so I don't know what to really say to that one about the buffer overflow thing. What would I use instead otherwise?[/QUOTE] scanf("%s", buf);
[QUOTE=Octave;34626783]scanf("%s", buf);[/QUOTE] My teacher said scanf and gets were bad to use with strings... Any idea why he would say that?
[QUOTE=DSG;34627003]My teacher said scanf and gets were bad to use with strings... Any idea why he would say that?[/QUOTE] He doesn't know how to use them. (aka don't listen to him on that) I swear, some programming teachers are some of the worst programmers.
I have a list of monsters, and I have a map. Everytime the player moves they generate tiles they can see, and color them accordingly(however no list is made of those tiles). I want to make it so that when a player knows he can see a tile, all objects/monsters are revealed that are on that tile. What would be the best way to approach this problem? Make a list of visible tiles that gets discarded every turn, check through all the monsters/items to see if any are displayed on the tile, or something else?
[QUOTE=ief014;34627034]He doesn't know how to use them. (aka don't listen to him on that) I swear, some programming teachers are some of the worst programmers.[/QUOTE] If you can't do, teach. (This doesn't apply to all of them; some of my college professors are really good.) [editline]10th February 2012[/editline] [QUOTE=DSG;34626702]-ansi -Wall -pedantic are my required compiling commands,[/QUOTE] What the hell, I just compiled it again with those switches and it still compiles fine for me (it just gives me one warning about line 55).
[QUOTE=shill le 2nd;34630189]If you can't do, teach.[/QUOTE] This will always be true until teachers start getting paid decently. Why would you take a teaching job when you can be paid so much more in a real programming job?
[QUOTE=swift and shift;34630391]This will always be true until teachers start getting paid decently. Why would you take a teaching job when you can be paid so much more in a real programming job?[/QUOTE] I don't understand it. Every programming teacher I've had were terrible. [QUOTE=ief014;34627034]He doesn't know how to use them. (aka don't listen to him on that) I swear, some programming teachers are some of the worst programmers.[/QUOTE] To expand more on this; Firstly, your teacher should be explaining why they think it's not good to use. Secondly, they should be teaching you how to use it properly anyway.
How do i do collisions with a Vector3 and a list of vertices in XNA? Third time's the charm :D
[QUOTE=ief014;34630666]Firstly, your teacher should be explaining why they think it's not good to use. Secondly, they should be teaching you how to use it properly anyway.[/QUOTE] Gets() [b]cannot[/b] be used properly.
[QUOTE=Funley;34633227]How do i do collisions with a Vector3 and a list of vertices in XNA? Third time's the charm :D[/QUOTE] What does the list of vertices represent? A point cloud? Ordered vertices of a polygon? What does the Vector3 represent? A position? How do you want to "do collision"? Do you just want to know if the point is inside the polygon or not, or do you want to move it outside the polygon too? We need more information.
Hi, I need some help parsing/serialising the output from the Facepunch API. The output is in JSON, and I'm using C#. [URL="http://pastebin.com/eGiRj8Hn"]Example output[/URL]
[QUOTE=thomasfn;34634333]What does the list of vertices represent? A point cloud? Ordered vertices of a polygon? What does the Vector3 represent? A position? How do you want to "do collision"? Do you just want to know if the point is inside the polygon or not, or do you want to move it outside the polygon too? We need more information.[/QUOTE] The Vector3 represents a 3D camera's position. The vertice list has VertexPositionNormalTexture objects, which are used to create polygons. The collision i want is to know when the Vector3 is a maybe 1-5 pixels away from a polygon.
[QUOTE=swift and shift;34630391]This will always be true until teachers start getting paid decently. Why would you take a teaching job when you can be paid so much more in a real programming job?[/QUOTE] Because I don't have enough debt already. I'd be OK with them redistributing things, so that administration gets less and the professors get more (i.e. the way it should be), but the whole financial situation for students is stressful enough without them having to hike tuition.
[QUOTE=Funley;34634891]The Vector3 represents a 3D camera's position. The vertice list has VertexPositionNormalTexture objects, which are used to create polygons. The collision i want is to know when the Vector3 is a maybe 1-5 pixels away from a polygon.[/QUOTE] The fast way out is use a physics engine, give the mesh to the physics engine and use the engine to determine if a point is inside of an object or not. If not this, you'll need to lookup and find/implement a "point inside 3d mesh" algorithm. Determining the smallest distance away from an object will be harder.
I got it now.
Is there someone that know where I could find a good tutorial explaining the magic tricks behind raycasting, I remember having seen one in the WAYWO threads and it got me interested. Thanks.
In java, I have a JFormattedTextField with an ActionListener added to it and utilizing this simple Mask Formatter: format=new MaskFormatter("####"); It works, but the ActionListener wont perform unless I've filled all four of the digits in the text field. I want it to take any integer with [i]up to[/i] four digits, not only four. Anyone know how to do this? I've been looking around and it looks like I may just need a normal JTextField with a custom Document, but I don't yet know how to write one of those. So, if that is indeed the only solution, if anyone could give me a link(s) to a good resource(s) for writing documents for text fields I'd really appreciate it. And yes, I'm fairly new to Java, so please just bear that in mind. Edit: Oh, and now that I think about it, I'd also like to know how to activate an ActionListener whenever someone edits anything in a JTextField/Area, rather than when the user presses enter.
I apologize for this being a complex topic, but I've gotten overwhelmed with too many sources each doing it their own way and my brain is full of confusion now. I'm attempting to implement GPU-based skeletal animation. I understand the GPU side of things and already have my vertexes uploaded with boneWeights/boneIndexes. Here's my understanding of skeletal animation: Each Model contains a "Skeleton", which is composed of an array of "Joints" (or bones). Each joint stores a translation/rotation matrix (not sure what this is local to, I think the parent joint) - I don't why we store the INVERSE of this matrix (according to some ways). Once you have a skeleton in the model, when you load a basic animation you store the joints as a quaternion (rotation) and vector (translation), because when you go to interpolate later it's easier to work with than a Matrix. At the end of each frame, for each bone in the skeleton, you need to build it's final translation matrix. To do this you create a matrix based on it's animation, then walk up the chain multiplying by it's parent matrix each time... and by it's skeletal-bind animation too? Then these matrixes are uploaded to the GPU, you modify the vertex's position by each boneMatrix * it's weight. How far off am I?
How do you change the center of rotation for a model in XNA?
[QUOTE=laharlsblade;34641247]Edit: Oh, and now that I think about it, I'd also like to know how to activate an ActionListener whenever someone edits anything in a JTextField/Area, rather than when the user presses enter.[/QUOTE] bind it to a keypressed or keyreleased event
[QUOTE=Mr. Smartass;34646492]How do you change the center of rotation for a model in XNA?[/QUOTE] By moving it as much as you need somewhere then rotating it? The moving vector can represent the center of your model. (I only know openGL specific code but you can do the same with xna)
[QUOTE=Naarkie;34634835]Hi, I need some help parsing/serialising the output from the Facepunch API. The output is in JSON, and I'm using C#. [URL="http://pastebin.com/eGiRj8Hn"]Example output[/URL][/QUOTE] Try [URL="http://json.codeplex.com/"]Json.NET[/URL]. It has a [URL="http://james.newtonking.com/projects/json/help/LINQtoJSON.html"]good interface[/URL] and apparently is [URL="http://james.newtonking.com/archive/2012/01/23/json-net-4-0-release-6-serialization-performance.aspx"]quite fast[/URL] too.
[QUOTE=evil-tedoz;34639411]Is there someone that know where I could find a good tutorial explaining the magic tricks behind raycasting, I remember having seen one in the WAYWO threads and it got me interested. Thanks.[/QUOTE] [url]http://lodev.org/cgtutor/raycasting.html[/url]
I understand this could be done with a couple of google searches and maybe some digging around in the options, but how do I stop Visual Studio from changing this [code]private void Function(){ //code }[/code] into this [code]private void Function() { //code }[/code]
Ok so say I have an audio file that plays back at a sampling rate of 96000Hz. AndroidOS, from what I gather from reading the API on AudioTrack, only supports sampling rates up to 48000Hz, but it's preferable to keep playback around a rate of 44100Hz (since most mobile devices don't support above it). What would be the process of downsampling to 44100Hz? I've worked with audio before, but I've never had a situation where I had to downsample or upsample streams. I've been trying all I can think of, but nothing I've tried so far works. Unrelated to above problem: [QUOTE=nick10510;34650225]I understand this could be done with a couple of google searches and maybe some digging around in the options, but how do I stop Visual Studio from changing this [code]private void Function(){ //code }[/code] into this [code]private void Function() { //code }[/code][/QUOTE] Assuming you're using C#, just go here: [img]http://i.imgur.com/6eD8r.png[/img] Just uncheck whatever you need and it should work. Hope that helps.
I'm working with WebGL in javascript for the first time, but no matter what I do I can't get my textured quads to show up. Would anyone care to look through my code and see if they can spot my mistake? [url]http://dl.dropbox.com/u/40398697/WebGLProject/WebGLProject.rar[/url]
[QUOTE=BlkDucky;34649775][url]http://lodev.org/cgtutor/raycasting.html[/url][/QUOTE] Thank you !
How can i draw 2D lines that go from point A to point B in XNA?
[QUOTE=Funley;34651327]How can i draw 2D lines that go from point A to point B in XNA?[/QUOTE] Have a look into [url=http://msdn.microsoft.com/en-us/library/bb196411.aspx]DrawUserPrimitives[/url]
Thanks bluefire!
Sorry, you need to Log In to post a reply to this thread.