Hot answers tagged

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


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


3

The simplest way to do it would be to lay out your weapon combinations in whatever order you see fit in a circular list. Each combination could have a bonus against the 22 combinations after it in the list, and a weakness against the 22 before it. The player might appreciate a more straight-forward or easier-to-recognise logic to that order -- some sort of ...


2

You don't need matrices at all. Just take the rotation angle in radians, get its cosine and sine, multiply them by the distance you want between the two objects and add the x and y values of the fixed object: rotatingObject.x = Math.cos(rotationAngle) * distance + fixedObject.x rotatingObject.y = Math.sin(rotationAngle) * distance + fixedObject.y


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

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


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


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



Only top voted, non community-wiki answers of a minimum length are eligible