Tag Info

New answers tagged

2

Sorry everything would look nicer if latex formatting would be possible. Let's consider three gears: G1, G2 and G3. Now each gear has a given radius r1, r2 and r3. The problem is to find the angular velocity for each gear (denoted av1, av2 and av3). From a physics course we know that the tangent velocity v is proportional to the radius: v1 = av1 * r1. ...


0

Simply adjust your vector3s to vector2s. You're 2d not 3d so having no value for y may be your issue. Not 100% til I try it out, but I'm not home.


2

I'm not sure if I understand your question but here goes: I think you want the sprite to wave over an angle back and forth: Not this is pseudocode (as you didn't state the language): t=(t+wavespeed)%TwoPi; a = Sin(t)*amplitude; Position.X=StartPosition.X + Cos(angle) * a; Position.Y=StartPosition.Y + Sin(angle) * a; t controls the waving motion; the ...


0

A line does not make a closed boundary, so a line is never a polygon.


0

No, Pincushion distortion is not actually the inverse of Barrel distortion. (Proof below) This paper seems to be shooting for exactly what you want: http://sprg.massey.ac.nz/pdfs/2003_IVCNZ_408.pdf (Formulas inside) Proof as promised: By contradiction for simplicity. Extracting the relevant fact about Barrel (and/or Pincushion) distortion: (2): We ...


1

The Wikipedia article on collision detection has this to say on the topic of matrices and collision detection; So we reduce the problem to that of tracking, from frame to frame, which intervals do intersect. We have three lists of intervals (one for each axis) and all lists are the same length (since each list has length n, the number of bounding boxes.) ...


1

Technically, a line has no beginning or end. It is infinite in length. For disambiguation, this is often called a ray in graphics programming. A line of this type is described by any point on the line plus a direction. A line segment is what most people are referring to when they say 'a line'. It has a beginning and an end point. It's common to refer to a ...


0

No trigonometry is necessary; just a little vector geometry and linear algebra. Adopt the convention that bold face represents 2D vectors. Then define two new vectors: c == C - A (with coordinates c1 and c2) b == B - A (with coordinates b1 and b2) Now considering parameterized equations of: the line segment CD in terms of t; and the line ...


1

It's hard to tell what exactly you are looking for but line segments are commonly described by their endpoints, or by a point, a normalized direction vector and a length. Another way would be a starting point and a non normalized direction vector which also is the length. For the purposes of raytracing, I usually use that second form (starting point, ...


0

I figure that there's a really efficient way of computing this but I don't have it in my knowledge, but I'll do my best. ΔXYC is a triangle with vertices on points X, Y and C VW is a line which starts ands ends in points W and V ^PQR is the angle on point Q that comes and goes to points P and R Triangles ABC and CDB are congruent, so the ...


1

First you need to find the slope of the line from A to B, then find the perpendicular slope. Lastly, find where the lines intersect. The trick is that this is not actually a real triangle problem. Instead, you are trying to find the point on a line that is closest to another point (point C). The point on the line that is closest to the point will /always/ ...


1

Don't have the damage reduction be additive, have it multiplicative. Damage = Damage * (1.0 - helmetReduction) * (1.0 - gloveReduction) * (1.0 - trousersReduction) * (1.0 - upperArmorReduction) Each layer of armor reduces not the complete damage, but the damage remaining from the previous layer. As long as no single ...


1

Think ease of use. You always have to start with what you want to achieve first. And it can all be made simple - I want the weakest unit to kill the weakest player with 20 hits. I want the strongest unit to kill the strongest player with 10 hits. The rest is just curving the increments between them. You can build any game on these two considerations ...


1

Your point selection rules can be satisfied by a Poisson-Disk sampling distribution & can be solved in O(n) with Bridson's algorithm. Basically, the algorithm divides the output region into a grid of cells sized relative to the minimum allowable distance, such that only one point can appear in each cell. Then, when you consider adding a new point, you ...


0

Try fixing parenthesis: var pitch = Math.atan((v*v+Math.sqrt(v*v*v*v - g*(g*x*x+2*y*v*v)))/(g*x)); var pitch2 = Math.atan((v*v-Math.sqrt(v*v*v*v - g*(g*x*x+2*y*v*v)))/(g*x)); Consider also using atan2 function. Maybe in your case it won't fix anything but it's always good to know about it. https://en.wikipedia.org/wiki/Atan2


1

You'll need to create some way to control the damage passing through. For example: light armor has a maximum reduction of 75%, medium 85% and heavy 95%. If the total reduction combined is above the number, use that value instead. You could also create a weighed reduction: say the player wears one heavy, two medium and one light piece of armor: ...


3

You could reduce the damage for each piece individually. That way you never reach 0 unless a piece reduces it by 100%. You can get very low though. You could also make the different pieces never total 100%. Helmet max 15% torso max 20% arms max 10% legs max 10% Max damage resistance would be 55% like that. You could also go with a much more refined ...


0

I think it would make the most sense to use percentage based reduction, if you don't want to remove damage entirely. For example different pieces could provide different percentages of damage reduction: Helmet - 5% Gloves - 5% Chest - 15% Legs - 10% Total reduction = 35% Then for example if your character is hit for 40 points of damage you would do the ...


1

Since you are working in 3d world space, why not use the BoundingFrustum class? BoundingFrustum cameraBounds = new BoundingFrustum(view * projection); if(cameraBounds.contains(location)) { // it is in view } else { // not in view } edit. I assumed you are using XNA. If not, you can still reflect the XNA code to see how to make a Bounding frustum ...


2

Solution for 2D vectors: Vector2 AB = B - A; // Vector from A to B Vector2 A0 = r * AB.normalized; // Vector from A to 0° Vector2 A90 = new Vector2(A0.y, -A0.x); // Vector from A to 90° Vector2 P = A + Sin(alpha) * A90 + Cos(alpha) * A0; // Coordinate of arbitrary point on a circle For arbitrary 3D vectors A and B in 3D space you need coordinates of ...


0

Adapted from this page, which was linked in Eric Lengyel's paper. Given a view matrix, projection matrix, and a point and a normal for the desired plane, it produces the right projection matrix. rplane plane; D3DXPlaneFromPointNormal(&plane, &p, &normal); D3DXMATRIX matClipProj, WorldToProjection; WorldToProjection = matView * matProjection; ...


0

I think that the author is describing how to calculate a bounding sphere in a (rather poor, IMHO) roundabout way. I skimmed over the text you linked to and it doesn't make any sense to me, either. The basic concept of a bounding sphere is that the distance between the center of the object and any point on the sphere is always the same. So all you need to ...


0

You basically found out about transforms and spaces in 2D! If you enter this "new missile space" via translation followed by a rotation then you have to do the same thing in reverse, multiplied by -1. missile.rotate(-30 * TO_RADIANS); missile.translate(-30, -20); Now your missile is in "world space".


-1

Note that above fails for r1=720 and r2<=0. I would like this... d = mod (r1 - r2), 360) if(d >= 180) //r1 > r2 d = d-360; else if(d < -180) //r1 < r2 d = d+360;


1

It's all about adding more features and doing some processing on your output. You are currently generating a heightmap but what seems to be missing? First off there are no rivers or trees. To generate this I would sugest creating a second noise map that contains rainfall. Then maybe add a third one for fertility. The areas with high rainfall and fertilty ...



Top 50 recent answers are included