# kspansel

Member

84

122 Neutral

• Rank
Member
1. ## Frustum Culling Dx9

You need to initialize "ret" to true. Additionally: 1. Get out of the loop as soon as the plane test returns false (no point in checking the other planes if we're already out!) 2. No need to calculate P if you're not going to use it -- Kory
2. ## [D3D11] Depth buffer does nothing

Just a shot in the dark, but is it possible one of your shaders is disabling the depth buffer or depth writes? -- Kory
3. ## Spinning a wheel and stopping at a given angle

Thanks for the replies. I've come upon a solution that does what I need. You were both correct, I needed an equation I could solve for the angle, which I knew. However, the real problem was the fact that I was dampening the speed by a percentage each frame, thus giving me some funky exponential function based on the frame number. Making the resistance linear simplified things and allowed me to solve the equation. Basically, I did this: 1. Calculate the amount of time needed to slow the wheel's speed to zero, from its current speed. 2. Calculate the angular distance traveled in that time. 3. Using that distance and the ending angle, calculate the angle where the wheel needs to start slowing down to land on the given angle. 4. Once the wheel reaches the starting angle, it begins to slow down and eventually stops near the desired angle. It's not perfect, but it works. Thanks! -- Kory
4. ## Spinning a wheel and stopping at a given angle

Lets say I have a 2D circle that represents a Party Wheel. The circle is divided into several pie shaped slices of 2 different sizes. The idea is that the player spins the wheel and after a couple of rotations it eventually slows down and stops on a specific slice. So, my question is, once the wheel is spinning, how do I calculate the amount of resistance needed to slow the wheel down and stop on the correct slice? Currently, I just track the speed and angle and dampen the speed by a percentage each frame. This definitely slows the wheel down, but calculating the amount of dampening needed to land on a specific slice is difficult. I'm open to other approaches too. As long as it looks like a spinning party wheel that slowly stops on a given slice, then it fits my needs! Thanks! -- Kory
5. ## How To Develop a Demo RTS/FPS Engine?

If you can spare the 100 bucks, get Torque. It's a designed to be an FPS engine, but you can also purchase (for another 50 bucks) an RTS starter kit. I grabbed it about a month ago and it works great (didn't get the starter pack, though, cause that's the code I wanted to write!). I was somewhat disappointed at the lack of up-to-date resources (i guess they're focusing on the shader engine instead), but for a \$100 you can't beat that! -- Kory
6. ## Applied Torque [RESOLVED]

For every 1 meter you can divide it into 100 centimeters (ie. 1m/100cm). So if you have 50cm, then you have 50cm * (1m/100cm) = .5m The most important thing is that the units cancel. Doesnt make a difference if your talking 1 meter per 100 centimeters or .01 meters per 1 centimer. -- Kory
7. ## Is this code bad?

Well, the first question is: Why? What is the point of the templated ALLOCATOR class? -- Kory
8. ## Ground simulation

Another interesting solution would be to use cellular automata. This would handle the "floating islands" very nicely. Haven't done anything like this myself, but it is another option. There's a nice article in GP Gems 3. -- Kory

Instead of rewind, try: fseek( stream, 0L, SEEK_SET ); -- Kory Spansel Pipeworks Software Inc.
10. ## fast bitwise parsing in C++

I don't have much experience in this realm but you could try: int bit = (in[bp >> 3] >> (bp & 0x7)) & 1; bp++; That atleast gets rid of the division and remainder ops, but I wouldnt be able to tell you how much faster it is, probably fairly insignificant. If it's ease of access you want, you could use a bit field: struct OneByte { unsigned char bit0 : 1; unsigned char bit1 : 1; unsigned char bit2 : 1; unsigned char bit3 : 1; unsigned char bit4 : 1; unsigned char bit5 : 1; unsigned char bit6 : 1; unsigned char bit7 : 1; }; Again, like I said, I'm not really familiar with huffman encoding, but the best thing to do (if possible) is not to work with single bits directly. If you know which bits you need in each byte, mask those out and recombine them into a full byte (I'm assuming you will need the full byte anyway). Hopefully, that was atleast somewhat useful. -- Kory Spansel korys@pipeworks.com

12. ## Problem doing some calculations

Seems fine to me. Since it's a zero-based index (block 0 through block 37 is actually 38 blocks total) your getting the "block" index. If you're trying to figure out how wide the map is in blocks just do: width in blocks = int(width in pixels / 32) + 1; -- Kory
13. ## Samsung SDK

I just started doing some mobile development and I was wondering if Samsung has an SDK for their mobile phones? I have an SGH-E715 and I would like to be able to access pixels directly. I've searched all over their site, but I haven't found anything. At the moment I'm using J2ME/MIDP2.0 but it doesn't offer the capabilities that I need. Also, what is the best way to keep your game images resolution independent? Creating seperate graphics for each resolution just isn't feasable. Any ideas? Kory
14. ## YawPitchRoll on a point?

Google for object picking. What it sounds like to me is you want to basically select objects using the mouse. Is that correct? If so cast a ray (in world coordinates) and check for a collision between your plane (quad) and the ray. Kory