Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

  • Days Won


alvaro last won the day on October 13

alvaro had the most liked content!

Community Reputation

21411 Excellent


About alvaro

Personal Information

  • Role
  • Interests

Recent Profile Visitors

44000 profile views
  1. Hi, A friend of mine is an animator in Japan and I would like to experiment making a small video game using his animations. His tool of choice is Live2D, which seems to be very popular over there. I looked around trying to find documentation of their formats, but didn't get very far. There's an API with nearly no documentation. They claim to have Unity integration, so perhaps that would be a way to do it (although I am not terribly keen to learn Unity just for this). Does anyone here have experience importing from this animation tool? Of course he could always provide me with a sequence of .PNG files, but I would like to see what alternatives we have. Thanks! Álvaro.
  2. First of all, use coordinates where (x1,y1) = (0,0): Just define (x,y):=(x2-x1,y2-y1) and you are now shooting from the origin. Even if the "time for arrow to fly" doesn't matter, figuring it out is the easiest way to solve the problem. Imagine that the hit happens at time t. At that time, you know that x^2 + (y+5*t^2)^2 = 400*t^2 Expanding that you get 25*t^2 + (10*y-400)*t^2 + x^2 + y^2 = 0 Plug in the values of x and y, and you get a quadratic equation where the variable is t^2. Solve it. In general there will be two solutions. Pick one of them. Take the square root to get the time t (the one you didn't care about). Now you know that the movement in the horizontal direction is linear, so x = 20 * cos(alpha) * t, and from there you can easily compute cos(alpha). Finally take the arccos and you have solved your problem. Try to do this step by step and let me know where you got stuck. Oh, and please don't edit your posts, or this conversation will be ruined for anyone that might encounter it in the future.
  3. alvaro

    questions about Utility AI

    Wait. I thought you were responsible for the name "utility-based salad".
  4. This is something you normally learn in school. Look up "constant acceleration" on the web. The formula you wrote describes the velocity under constant acceleration. The "1/2" and the "^2" come from integrating that formula to get the position under constant acceleration (the integral of x from 0 to t is t^2/2). Acceleration --(integrate)--> Velocity --(integrate)--> Position Acceleration <--(differentiate)-- Velocity <--(differentiate)-- Position If you know nothing about calculus, ignore everything in this post except the first line. Or go learn some calculus.
  5. Two ways to think about it: (1) Imagine the points of space that can be reached in time t, first with no gravity. It's simply a circle of radius v*t. Imagine that circle being animated over time. If you now introduce gravity, you can think of it as acting on the center of the circle, bringing it down as it grows. The formula (1/2)gt^2 is just the position under constant acceleration. (2) If you use a frame of reference in free fall, there is no gravity. Using that frame of reference corresponds to the change of variable y' = y + (1/2)gt^2, and in these (x,y') coordinates you are back to the situation without gravity.
  6. They way I normally do this is by first figuring out at what time the impact will happen. If we had no gravity, the position of the projectile would satisfy x^2+y^2 = v^2t^2 Since we have gravity, we have to modify this a bit: x^2+(y+(1/2)gt^2)^2 = v^2t^2 That is a quadratic equation in t^2. Solve it, and if there are any positive solutions, compute the corresponding value for t. Once you have that, you can figure the angle by looking just at the horizontal coordinate. x = v*cos(alpha)*t => alpha = arccos(x/(vt)) This seems much more manageable to me.
  7. alvaro

    Commonly Used Forms of Calculus

    There are many things in calculus that are used in game programming: derivatives (e.g. many optimization problems, computing normals to a surface), computing integrals (e.g., the rendering equation), integrating differential equations (e.g., Physics simulations, or gameplay where velocity is added to a position, as Fulcrum.013 points out). [Note on Fulcrum.013's post: In games you rarely care about the accuracy of an integrator that much: Stability (implicit methods) or preservation of energy (symplectic integrators) are often much more important features.] You also get to use calculus in programming in general. If you have an algorithm with a loop that takes time proportional to 1/k for k=1..n, the whole thing will take time roughly proportional to log(n), because the sum 1/1+1/2+...+1/n can be approximated with the integral of 1/x from x=1 to x=n. There are more exotic parts of calculus that also get used. For instance, spherical harmonics can be used in global illumination computations. You should learn calculus because it's important to understand the world. As a bonus, you get to use it in programming games!
  8. When computing a determinant, you can scale a column and add it to another column without changing the result. So if you add (-2D_x) times the first column and (-2D_y) times the second column to the third column, you'll get the transformation you see.
  9. I just want to point out that you don't need to use angles for this (or for pretty much anything else). Assuming you are using quaternions to represent attitudes, you can compute the rotation that would bring your current attitude to your desired attitude with one division. The logarithm of this quaternion will give you the angular velocity that you would have to apply for one unit of time to get where you want. That's the P term in your PID controller. The D term is your current angular velocity. I can think of a couple of ways of implementing the I term, but you can start without it and think about it later. I can put together some sample code for this PID controller if you are having a hard time. Just ask. There is also a dynamic-programming approach to optimal control theory which would be interesting to apply to this problem, but that's more involved.
  10. Figuring out the angular impulse to reach some target orientation is the angular equivalent of figuring out the linear impulse to reach some target position. It basically makes no sense. You have to decide how quickly you want to get there, as pcmaster pointed out.
  11. alvaro

    Quaternions, how does ki = j?

    You still haven't given me the list of axioms you are starting with, and without that I can't even start to help you.
  12. alvaro

    Quaternions, how does ki = j?

    I've always thought of quaternions with all those identities to begin with, but there's probably a shorter list of properties from which all of these can be deduced. I imagine that's what you are trying to do. That's why I was asking what axioms you are starting from.
  13. While you are at it, instead of vague descriptions of the results you are getting, post pictures of what you get and --to the extent you can-- what you would like to get.
  14. alvaro

    Quaternions, how does ki = j?

    I'm not sure what axioms you are assuming in your computations. In other words, I don't know which known identities you are using to try to deduce other things. To me the basic identities are: i2 = j2 = k2 = -1 ij = -ji = k jk = -kj = i ki = -ik = j You can easily compute anything with those. You seem to start with ijk=-1, which is true, but I had to do (ij)k = k2 = -1 in my head to verify it. To go from j(ijk) to -ij2k, I simply swap the order of the first "ji" to "ij", which makes the sign flip: j(ijk) = (ji)jk = -(ij)jk = -ij2k Alternatively, just compute both sides and verify they are -j.
  15. alvaro

    "Nice" tweakable S-function

    Try this: 1/(1+exp(-s*(-log(1/x-1)))) s=1 is the identity. As s grows, the function converges to the step function, as you wanted. Values of s between 0 and 1 are also possible, and behave reasonably. EDIT: Oh, I think my function is actually the same as x^s/(x^s+(1-x)^s), which is what Zakwayda pointed to: http://www.wolframalpha.com/input/?i=simplify+1%2F(1%2Bexp(s*ln(1%2Fx-1)))-x^s%2F(x^s%2B(1-x)^s),+assuming+s>1+and+0<x<1
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!