Tag Info

New answers tagged

0

Usually this is handled a bit differently. When manipulator is picked, you choose a movement plane (XY, YZ or XZ). Then you cast ray from cursor on to that plane and detect the hit point and move the manipulator (and object) to that location. Special cases you need to work around for are when the plane is parallel to the view and ray from cursor can reach ...


1

There is such an equation, but it's not easy to obtain. Because the magnus effect depends on the ball's current velocity, it changes when external forces are applied. You cannot calculate the position of the ball by linearly summing the contributions of different forces. If you were hoping you could simply add a few terms to x(t) = ½ a t² + v t, you're out ...


0

First create a vector. It's angle is equal to ball spin speed (degrees per frame) plus the balls trajectory angle ( looking down from the sky). Set the magnitude to however much you want it to effect the trajectory of the ball. Add this vector to the balls vector, or position if you don't use vectors. Probably a good idea to make the magnitude ...


3

Others have pointed out how you can use the sign of the dot product to broadly determine the angle between two arbitrary vectors (positive: < 90, zero: = 90, negative: > 90), but there's another useful geometric interpretation if at least one of the vectors is of length 1. If you have one unit vector U and one arbitrary vector V, you can interpret the ...


2

If the resulting scalar is 0; then it means the 2 vectors are perpendicular to each other (angle difference 90 degrees) . If the resulting scalar > 0; then the angle difference between them is less than 90 degrees. If the resulting scale is < 0; then the 2 vectors are facing opposite directions ( or angle difference > 90 degrees). This can be useful in ...


0

the dot product is equal to v1.length() * v2.length() * dot(v1.normalized(), v2.normalized()) the most you can get out of that is whether the angle is acute or not or pass to other algorithms where you can delay the normalization. But you can get the normalized from the non-normalized by dividing with sqrt(v1.lengthSquared() * v2.lengthSquared()) (saves a ...


1

You might want to consider an algorithmic solution that matches the situation. That is, consider why there are diminishing returns in your game situation, and model those. Multiple facilities of the same type might have diminishing returns is that there might be other resources or facilities which they depend on, or which result in bottlenecks, or other ...


4

In general, a linear equation will start with y = mx + b, where b is your starting value, and mx is how you adjust the starting value as x increases. So the first part of your equation, the b, will be 10 because you want farms to start at 10 food. y = mx + 10 Next, in your case, you want to adjust the food by produced by every ten farms. So you will ...


15

Diminishing returns = decreasing derivative Since you still want some returns even at higher levels means that the derivative should be positive, otherwise building more farms would decrease the food production (which might even make sense if you take into account logistics and upkeep costs) It should approach zero assymptotically, if it goes towards a ...


26

For formulating a diminishing returns equation, I'd immediately think fractions. This is a graph of y=1/F y will get smaller as F gets larger. This will give you a steady drop-off that never reaches 0. From this you can transform it to get the sort of curve that you want. Using numbers > 0 will always give positive output that is never 0. Honestly, I'd ...


4

Would a linear diminishing return do? production per farm = (1 - (0.05 * (f/10)) ) * production rate. This gives a total production (rate * # of farms) peak at f = 100.


1

A normalized direction is a point on the unit sphere, so you need 2 angles. I assume you have a coordinate system where Y is up. Your two variables are phi (0 <= phi <= pi) and theta (0 <= theta <= 2pi). You obtain the normalized direction vector as follows: dir.x = cos(theta)*sin(phi) dir.y = cos(phi) dir.z = sin(theta)*sin(phi) Source for ...


0

Is it because the eye-at = (0,2,0) and therefore the cross product of up x (eye-at) = (0,0,0) and that means, that no real transformation matrix can be constructed? Exactly, the actual values in the resulting matrix is just the coordinates of the view direction (at-eye), up and right vectors next to each other; result = [[right.x up.x view.x] ...


1

Create an octree and in each leaf cells put the list of all triangles from B that intersect the cell, mark at each levels whether or not the cell is empty. If one cell at any level has only 1 poly note the poly so you can stop the search early (large floor/wall triangles). You can keep sub-dividing cells until you have a reasonable number of triangles in ...


0

I think some of the answers here are missing something. I think what you really want is controls and not physics. Let me explain. Control theory explores the mathematics of systems that can sense a value, and control themselves to reach a target value. Examples of this include climate control systems, anti-lock breaking systems in cars, robots, and yes even ...


1

When using a R/H Cartesian coordinate system with the Y axis as vertical and row major matrix transforms (common for DX9), and you set your model in your world such that when rendered using an Identity matrix, the nose of the aircraft will be pointing down the -Z axis: then the negate of the third row of the transform matrix can be used as a direction ...


3

Here are four options that you can try: A) Scale & threshold existing output You can ensure that the gradient saturates at some maximum value before reaching any of the cell borders. This will tend to make small holes of uniform size, but you can introduce size variation by assigning a random scale factor to each seed point and scaling distances to ...


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



Top 50 recent answers are included