# Tag Info

## New answers tagged mathematics

0

This is in no way a complete answer. What you could try is: for each finger touching the interface, you calculate the distance and direction of each particle from the touch point. With the distance, you compute a force (use x as input, and have y result in something based on a logarithm or square function: the closer to the well, the stronger the force). ...

3

Your problem is that you're trying to compare floating-point numbers for equality. The matrix inversion and multiplication, however, will inevitable introduce slight rounding errors that will make the numbers in the two matrices not exactly equal. Still, let's compare your debug printouts side by side. I've deleted the M1 and TR rows, and left just the ...

1

I don't really understand your question to be honest but I think you're trying to figure out how to find the world matrix of a child node. In other words, you essentially have a scene graph with parent nodes and child nodes and you want to know how to calculate the world matrix of one of the children. Essentially it's a two step process. First you need to ...

0

The whole setup seems a bit strange. Is the speed always a fixed number, and what you're dealing with now is how to choose direction? Or is the speed dependent on the movement as well? If the latter case (speed dependent on mouse movement): You should either make this "physical", i.e let the delta mouse movement result in acceleration, or link delta ...

-2

This code is adapted from a game demo in 'Cocos2d-x by Example Beginner's Guide' by Roger Engelbert. circleSprite->setScale(0.1f); circleSprite->runAction(ScaleTo::create(1.0f, 5.0f)); First it makes the sprite tiny (0.1f) and then runs an action to scale it up over 1.0 second (I have used an arbitrary scale to value of 5.0f for this example). The ...

1

You can't get the "right" vector from just a "forward" vector. Any particular "forward" vector could have an infinite number of different legal "up" and "right" vectors. For example, if I am looking forward along the z axis forwardVector = vec3(0,0,1), then I could have up be along the y axis upVector = vec3(0,1,0) and right therefore be along the x axis ...

2

So first, in the formula: velocity.x = x - ( x + ( 10 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) ); The two 'x's cancel out each other: x - (x + n) is same as x - x - n Then to convert an angle to a vector you need to use sin AND cos. velocity.x = speed * math.cos ( rz * math.pi / 180 ); velocity.y = speed * math.sin ( rz * math.pi / 180 ); In ...

2

It's the same as you'd do it for 2D, just with an extra axis. Use the same exact equations you do for a 2D game, something similar to the equations of motion or the kinematics equations. For each axis (X, Y, Z) Sum the forces for that axis (gravity, jump force, weapon knockback, etc. Keep in mind, some of these forces will be 0 on some of the axis, like ...

1

Here's a fast and easy way to do it in python: from numpy import * def ClosestPointOnLine(a, b, p): ap = p-a ab = b-a result = a + dot(ap,ab)/dot(ab,ab) * ab return result

0

If you want to get position A relative to B, you just need to substract them, like you were doing. If you want to make use of the methods, you can use the method "sub": https://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Vector2.html#sub-com.badlogic.gdx.math.Vector2- Vector2 relative = A.sub(B); //contains the position of A relative ...

0

There are lots of algorithms to check whether a point is inside or outside a polygon. The simplest being the ray casting algorithm. The idea is, you cast a ray (assume a line) from your point to either the left or the right. Then for each side of your polygon, you test whether the ray intersects it, and if it does, you add 1 to a counter. At last, if the ...

3

Unless I missed something here doing this ... var progress = 0.05 * mathSQRT(player.score)) * (1 + player.kd / 10); ... will get you a value of how far the user has "progressed". The level is that value rounded down to the nearest integer or 1 with ... player.level = mathFLOOR(mathMAX(1, progress)); .. the progress between the current level and the ...

1

The clearest way to make sense of any equation is to figure out the units. In this case, it's a bit ambiguous, but you know that velocity is m/h and that radius would be some kind of distance. v^2 is a good assumption in this case, but it is not immediately obvious why without knowing something about the units of the denominator. Just by looking at this, ...

0

Edit: Someone pointed out that R is in feet. Makes sense as well, and the rest stands. When in feet, the formula probably describes a tightest recommended curvature instead of a comfortable curvature. If solving from the formula the speed for this scandinavian location, it would be 30 mph or 48 km/h. The speed limit there is 40 km/h, so 48 is uncomfortable. ...

3

While Jibb Smart already gave a good answer within the constraints of the question, I would like to step a bit outside the box and question: "Do you actually need perfect balance"? A perfectly imbalanced system can work too and often makes for far more interesting games. For example, you can have one weapon combination which is slightly better than 43 ...

Top 50 recent answers are included