Jump to content
  • Advertisement

d00fus

Member
  • Content Count

    167
  • Joined

  • Last visited

Community Reputation

328 Neutral

About d00fus

  • Rank
    Member
  1. hi, there, I've a question regarding AABB
    plz clear me if i m wrong. example - If i have a 3d pyramid the the AABB will be the box like collider thats cover the entire pyramid??? (I used the term box & collider as just a reference )
  2. d00fus

    Bullet Trajectory - Questions

    It sounds like you are still thinking in terms of a closed form solution to your motion. This only works if the trajectory is fixed at launch time, but obviously in your case that's what you are trying to change. What you want to do, at least to start with, is simply do the following each frame: position += velocity * dt velocity += acceleration * dt where position, velocity and acceleration are all 2D vectors. dt is the delta time, which is the time since the last update, not the total time or time since firing the projectile. You can vary the acceleration as you see fit, based on the accelerometer values. This is an example of Euler Integration, if you google this you'll find a lot more information.
  3. d00fus

    SAT Fails on some test??

    There shouldn't be any problem with the triangle case, there must be a bug in your SAT implementation. Can you post your code? The ASCII art makes it look like the second case is a concave polygon? Collision detection using SAT won't work for concave polygons, you'll need to split the polygon into convex parts and test against those.
  4. d00fus

    C++ constructor question

    Quote:Original post by popsoftheyear My point was that it turned out that T x = T(a); // or T x(T(a)); and T x(a); were coming out to be the same. I had expected the first one to create a temporary T, and it didn't. My understanding of the standard is that T x = a; is semantically equivalent to T x = T(a); which is likewise equivalent to T x(T(a)); However, an implementation is free to (and almost certainly will) optimise out the temporaries. The following section of the standard I think specifies this: Quote: From section 8.5: Otherwise (i.e., for the remaining copy-initialization cases), user-defined conversion sequences that can convert from the source type to the destination type or (when a conversion function is used) to a derived class thereof are enumerated as described in 13.3.1.4, and the best one is chosen through overload resolution (13.3). If the conversion cannot be done or is ambiguous, the initialization is ill-formed. The function selected is called with the initializer expression as its argument; if the function is a constructor, the call initializes a temporary of the cv-unqualified version of the destination type. The temporary is an rvalue. The result of the call (which is the temporary for the constructor case) is then used to direct-initialize, according to the rules above, the object that is the destination of the copy-initialization. In certain cases, an implementation is permitted to eliminate the copying inherent in this direct-initialization by constructing the intermediate result directly into the object being initialized; see 12.2, 12.8. (emphasis mine)
  5. d00fus

    C++ constructor question

    This goes into the same question. The gist of it is that T x = a; and T x(a); are mostly equivalent, except when used with explicit constructors, in which case only the latter succeeds.
  6. d00fus

    [C++] Coding Styles

    Quote:Original post by WuTz #define DoFoo(x) x=x*x/x+x-x Was just straight of my head. #define DoFoo(x) (x=x*x/x+x-x) would be right. Man, it was just an example. Unfortunately that still isn't right. What rip-off was getting at is there are a number of issues with using macros in this way. What does DoFoo(i++) do? What does DoFoo(i + 1) do? What does DooFoo("Hello") do? All of these problems go away if you use a function, which is why it is generally recommended.
  7. d00fus

    SSE Performance

    Quote:Original post by Antheus The point of SIMD (especially Streaming part) is to call function once, and the intrinsics process million elements in same call. Emphasising what Antheus has already said. A lot of people (a search of the forums will find roughly the same question asked many times) think they can re-implement their Vector4 class with SSE and suddenly everything is 4 times faster. You will quickly find that this is not the case, and at best you may get small speedup (I would offer less than 10%) if you are careful about 16-byte aligning all your vectors, making sure your operations inline and carefully writing the SSE. The real win from SSE comes from processing a large number of elements in one go, where you have determined through profiling that this operation is a bottleneck. This way the setup work of SSE is amortised by processing many elements all at once, you get more efficient cache usage and ultimately, hopefully, a much improved performance boost.
  8. I might be missing something, but won't a simple resize(0) rather than clear() do what the OP wants?
  9. It's because you are only inserting As in your copy constructor: m_a.insert(new A(**it)); What you probably want is an idiom known as the "virtual copy constructor". Also, your copy constructor should take a const reference, rather than a non-const reference :)
  10. d00fus

    3d SAT implementation

    If you visualize the direction of the cross product, you'll see that the cross product axes catch the cases where you have edge-on-edge collisions. If you leave them out, you'll find you get false positives (i.e. indicate intersections where none exist). The cross product axes you need to test are the cross products of the edge vectors of one polyhedron with the edge vectors of the other. In simple cases (AABBs and so on) you'll find many of the axes are duplicated, which reduces the number of axes to test.
  11. d00fus

    Smooth character movement (theory)

    Generally you'll do this by specifying positions and movements using either floating or fixed point numbers. These allow you to specify sub-pixel units, so for example, you can add 0.2 to the y-coord each frame, so every 5 frames it will move one pixel. I'm not familiar with the Blackberry hardware but you might find fixed point is much faster if it doesn't have floating point hardware.
  12. d00fus

    Axis Aligned Bounding Box

    Quote:Original post by akaitora d00fus, thanks for the reply. In your example, would the center be the minimum vector and overall be the maximum vector? No, the minimum and maximum vectors were the two given at the end of my post. They represent the boundaries or limits of the AABB on each of the 3 axes. You can convert a center and extent representation to a minimum-maximum representation just with: minimum = center - extents maximum = center + extents Maybe a 2D example will help too: if you have a 2D AABB and your positive x axis points to the right and positive y axis points up, the minimum point will be the "bottom-left" point of the AABB (the lowest x and y values) and the maximum the "top-right" point (the highest x and y values).
  13. d00fus

    Axis Aligned Bounding Box

    Perhaps an example might help. Imagine you have an AABB with its center at [1, 2, 3] and the box has overall dimensions [10, 8, 12]. If you convert these dimensions to distances from the center, you get [5, 4, 6]. These are usually called the half-extents or just extents, which is hopefully pretty clear. This means the minimum x position still within the box is 1 - 5 = -4. Similarly the maximum x position still within the box is 1 + 5 = 6. Equivalently you could say the AABB encompasses the range [-4, 6] on the x axis. Note that the distance between -4 and 6 is our original box dimension (10) on the x axis. And likewise for the other 2 axes. If you collect all the minimum values together, you have the minimum point of the AABB [-4, -2, -3], and similarly the maximum point [6, 6, 9]. Together these two points give an alternative representation of the AABB to the original center and dimensions. One representation isn't necessarily better or worse than the other; each has times where it is more suitable, and they are easily interchangeable.
  14. d00fus

    [c++] templates help

    I believe Zahlman just accidentally omitted the word data in the first sentence (he included it later in the post): Quote: This is impossible; you can't have a template data member in a non-template class. In which case he is correct.
  15. d00fus

    Sorting linked lists

    Merge sort is commonly used to sort linked lists, and is very efficient with O(nlogn) time complexity in the average and (importantly) worst case.
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!