Tag Info

New answers tagged

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 ...


13

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 ...


0

You are able to use the dual marching cubes algorithm because it just operates on an array you provided. So your code generates an area in the form of an array and the marching cubes algorithm then scans over the scene starting at some origin point you assign and finds where all the edges of your volumetric data array would be located and places bits of ...


2

If you write a 1 for a connection and 0 for lack of connection, and have 8 sides, then you can write out the configuration of an octagon as a bit string. I'll order them as east, northeast, north, northwest, west, southwest, south, southeast. If north and west are connected to neighbors and other directions are not, this would be written 0 0 1 0 1 0 0 0. ...


1

Unless you want to allow octagons to overlap (when you would, you would be in quite a lot more trouble), it is impossible for two adjacent edges (a diagonal and an orthogonal) to be both connected to another tile. This makes stuff a lot easier. Separate each of your octagons into 9 tiles like this: You need one set of tiles where the diagonals are ...


2

Just rotate the point at an angle of -θ around the center of the rectangle. relx = x-cx rely = y-cy rotx = relx*cos(-theta) - rely*sin(-theta) roty = relx*sin(-theta) + rely*cos(-theta) dx = max(abs(rotx) - width / 2, 0); dy = max(abs(roty) - height / 2, 0); return dx * dx + dy * dy; Also, remember this is still the distance squared, so you need to take ...



Top 50 recent answers are included