New answers tagged

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


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


0

Edit: Nevermind the matrices, look at what user6245072's answer instead. It's more simple. I was thinking too hard :p That, would be matrices. There's a lot of websites that explains it for you. This is a matrix i took from an util class i made my self a while back: [Math.cos(ang), -Math.sin(ang), 0.0f, (-X * Math.cos(ang) + Y * Math.sin(ang) + X)] ...


-1

Here is the code I use to get the angle of a 2d vector, hopefully it is what your are looking for. (using our own library functions, most of which should be obvious) float zVec2f::getAngle () const { //straight up, 0.0f degrees zVec2f up(0.0f, -1.0f); //angle between up vector and our vector zVec2f normal = *this; if ( ...


0

In my own project I suddenly came to the same conclusion - the parent scale shouldn't be passed down to the children's transformation matrix. And I thought it was weird too. I figured, if you want to stay consistent throughout your code, either you pass through all of it, or you pass through nothing. However, seeing how you came to the same conclusion is ...


0

The simplest way to do this is to use a hermite spline and lerp the parametric value.


0

Why not lerp the position and update the target destination as it changes? You might have to look at how lerping works but it would look something like this: public position startMarker; public float duration = 5.0f; private float startTime; void Launch() { startTime = Time.time; } void Update() { float distCovered = (Time.time - startTime) / ...


10

The edit is reassuring. :) Okay, here's a straightforward update loop... Assuming when we fire the missile we initialize remainingFlightTime = 5f then... void UpdateMissile(float deltaTime) { remainingFlightTime -= deltaTime; // At the end of the trajectory, snap to target & explode. // The math will put us there anyway, but this saves // ...


0

We have two cases, the first case being your ball is not colliding. Because of Newtons First Law your ball will have the originally random assigned velocity, \vec{v_{i}}. The second case is the one we are interested which is collision. Assuming we are operating in 2 dimensions then we can treat walls and edges of boxes as line segments. Using our current ...


0

I solved my problem using steering behaviours thanks to the suggestion by @Alexandre Vaillancourt. The "arrive" behaviour was the solution for me as suggested in his comment.


-1

Simple: Unlike the rest of these answers. V1*sin(dir) - V2*sin(dir) 30*sin(090) - 40*sin(270) = 70 If you want the range, just add it in like so Range-(30*sin(090) - 40*sin(270) = 70)


0

This can be done in a simple 3 step looped process. Step1: Clear screen of all moving objects or sprites Step2: Apply formula -- Height-(9.8)*T^2 Step3: Apply objects or sprites in new position I even made you quick graph to show you what I mean. https://www.desmos.com/calculator/f0bglhnjjg


1

You could rebuild the spears orientation matrix from a direction vector. Good example with dx code is here.. http://stackoverflow.com/questions/4237873/rotate-a-sphere-so-that-its-pole-heads-towards-the-camera/4237921#4237921



Top 50 recent answers are included