Tag Info

New answers tagged

3

You have only two main options, both of which have serious pros and cons: Use normalized positioning, so that the X and Y coordinates are expressed effectively as a percentage of the available width and height. Use absolute positioning, so the X and Y coordinates are exactly the pixel or point coordinates of the sprite on the screen. Relative positioning ...


1

Edit: my original solution didn't work. The eigenvalues of the mappping matrix only correspond to the scale factors for special orientation cases. Fortunately, I've found a solution that seems to hold in general. If we take a collection of unit vectors in UV space and map them into 3D, they will form an ellipse, whose major and minor axes correspond to the ...


0

You said it was easy when the two vectors were aligned to the X-axis. So, first align them to the X axis, and your problem is solved! The only difficulty will be finding out whether the blocks are inside a rotated bounding box (assuming that you wanted the blocks to cover the bounding box only). Vector point1; Vector point2; // First, create an ...


14

The dot product of two vectors can tell you if they face each other or not. First vector can probably be the enemies view direction the second one should be a vector pointing from player's position to the enemies position. https://www.youtube.com/watch?v=Q9FZllr6-wY


1

You want to use the following technique to modify the projection matrix. It moves the near plane to a given location (like the plane of the portal). http://www.terathon.com/lengyel/Lengyel-Oblique.pdf


0

I have not implemented this myself, but I would imagine using the the stencil buffer would solve your problem. Render the portal to the stencil buffer and then render the objects in the portal's frustum. You will then get pixel-perfect culling of the object. Here's a website with some details: ...


1

As you are creating a "fictional force" physics should be our starting point but the exact form can be up to you. My suggestion would be to use a modified drag rather than trying to modify gravity. Why you shouldn't use a modified gravity This is because gravity applies a simple acceleration. This means if an object is rushing towards the ground at 100mph ...


0

If I understand your problem correctly, it is as follows: Problem: You have no way of knowing when your progress bar stops scaling/progressing in x value. You would like to position a red bar (for player feedback) at the end of the progress bar only if it stops scaling/progressing. If this is correct, I think that I may be able to help. Answer: It seems ...


0

Common, easy but ultimately wrong answer Iterate along the vector in very small increments. Eventually they'll de-penetrate at a "reasonable" position, assuming you continue any additional constraints at each iteration. It's brute force, and for something simple, it's good enough. You will almost certainly need to add artificial max/min force limiters to ...


0

(Posting my comment as an answer) If you take the 3d plane for your cell and the line for that south pole, and find the intersection point, then you could use LookAt for that point. You would also want to handle the case where the plane is parallel to that line, in which case you could rotate the plane to a predetermined angle, to orient it correctly.


1

What you want is a curvilinear perspective projection matrix to correct for the perspective projection distortion. aka barrel or pincushion projection: http://en.wikipedia.org/wiki/Curvilinear_perspective Basically, you distort the image with a projection that is the opposite of the distortion you don't want so it all comes out straight in the end. ...


0

In finance the simplest model of prices is the lognormal distribution https://en.wikipedia.org/wiki/Log-normal_distribution To simulate this you create a random normal variate each "tick" (using Box-Muller http://stackoverflow.com/questions/2325472/generate-random-numbers-following-a-normal-distribution-in-c-c ) and multiply that by the price and a constant ...


0

If you want 100% to mean, "Right edge of Rect2 touches right edge of Rect1", then we just want the ratio of where the Rect1's left edge is within that reduced range of Rect2. (Rect2.left - Rect1.left) / (Rect1.width - Rect2.width) * 100.0 Should do it. (I used "left" instead of "x" to remove some possible ambiguity.) You could do it from the right, like ...


-1

This seems like a standard engineering problem. It is definitely possible to determine the rotations of all gears, even with multiple drivers. Read up on Gear Trains. If this is a big part of your work, it might be worth picking up a book on engineering dynamics. Good luck!


0

I didn't read your code but I think what you're looking for is something like this: var currentZoom, //The zoom % circleCenterX, circleCenterY, // The circles center for viewing dotX, dotY // The dots center for vieweing function zoomInOrOut(delta) // To zoom out use a negative value { if (delta < 0 && currentZoom <= 1.0) return; // ...


1

while zooming out, check if distance of red-dot and center of circle is more than circle's radius. (Lets call this distance, d) if so happened, move the circle in direction of V vector ( V = red-dot.position - circle.position`) for x unit. (x= d-circle's radius).


0

where do you get the information about which angles the algorithm is supposed to create between each pair of vectors? ... Where do I get the accurate angles for tangent and the bitangent? The tangent and bi-tangent are contained in each vertex. These values are interpolated across the surface of the primitive. At each rasterized pixel, the ...


0

An alternate (but potentially more difficult) method to solving OBB vs OBB collision is to transform one OBB into the space of the other, such that one of the OBBs becomes axis aligned. Basically you translate the two OBBs so that the center point of one is at (0,0) then rotate the two around (0,0) until the OBB at (0,0) becomes axis aligned. You can then ...



Top 50 recent answers are included