Bob Janova

Members
  • Content count

    1377
  • Joined

  • Last visited

Community Reputation

769 Good

About Bob Janova

  • Rank
    Contributor
  1. Well, both of those cases are valid quads. You need to define 'good' better.
  2. find 'axis' line of 3d mesh or 3d convex hull?

    Hmm. I don't know if this would work but I did a similar thing in 2D and it was useful to me. Take the mesh, copy it and scale it by -1 on all axes, and add the two (i.e., if the distance in the original mesh to the centre along [1,1,0] is 30 units, and the distance along [-1,-1,0] is 15 units, the distance in the new one will be 45 units along [1,1,0] or [-1,-1,0]). You probably need to quantise your solid angle space to model this, as the vertices will not line up. The major axis is along the vector which has the largest combined value (because the addition process makes the mesh symmetric, either direction along this vector is equivalent). You probably need to make sure the origin is in the middle of the mesh for this to work. It doesn't have any mathematical backing, either :p.
  3. Why did I try forces?

    'Real physics' for walking about on a surface don't really make sense. The actual losses in any sort of real world situation to friction mean that you actively have to keep walking to move. What Newtonian mechanics simulates is walking on ice with a rocket pack :p and that's not something that you identify easily with. For collision, you will normally have a function that returns the 'penetration vector' (i.e. which direction the collision happened in and how far into the other object you went). Move the object back by the penetration vector and remove any component of velocity in that direction (i.e. v -= DotProduct(pen.Normalise(), v) ).
  4. Simple collision responce?

    Two circles colliding with no friction will always perform a simple linear-motion collision. Look up 'sphere sphere collision mechanics' (or wait for someone for whom it is not 2am to answer :p).
  5. Deriving the rotation of a triangle (advanced)

    Why does the interdependence matter? Will B not be invertible in that case?
  6. Ball bounce

    The tangent to a curve (in 2D) means parallel to it. Using it in a 3D situation like this is imo slightly confusing, but if considered in the plane of the impact then it makes sense. I would actually work in impulses not forces; if you are assuming instantaneous action (rigid body mechanics) then forces are infinite and that's not useful. The normal impulse R is the one used for a simple bounce type collision resolution. It has a magnitude of (1+e)mv.n (n being the collision normal), where e is an elasticity factor between 1 (bounce) and 0 (rest against the surface). R is through the centre of mass of the object for a sphere and therefore imparts no rotation, although for other shapes that is not necessarily true. The frictional impulse F is given by f(v×R)×n (I think?), where f is a coefficient of friction. F is along the line of contact between the objects, and can be thought of in this plane as being along the tangent or the surface. It will always impart a rotation on both objects.
  7. Vector string representation

    For serialisation use an unambiguous format, it doesn't really matter which one you choose. It doesn't even have to be human readable. For displaying it you should display the components in the user's local format, so use an element separator which isn't a decimal separator anywhere (basically, anything other than . or ,). I often use ;.
  8. Programmer games

    These will only ever appeal to people who find programming fun (and don't burn themselves out in their day job) – so I wouldn't really recommend it unless you're going for a specific contest or something.
  9. Real-time curve/line intersection

    2D? I think you can do it like this (for an individual cubic Bézier curve): - Transform the curve into the line's space. I.e., if the line is (p+kd), with a normalised direction vector d, each point a on your transformed curve (i.e. the endpoints and control points) in line space are [x:(a-p).d, y:(a-p).n] where n is the line normal (in 2D, n=[x:-d.y, y:d.x]). - A Bézier curve in 2D is two parametric equations in t (alternatively a parametric equation with 2D vector coordinates): x = at³+bt²+ct+d y = jt³+kt²+lt+m Because we transformed the curve into line space, we are only interested in the Y component. You can obtain the coefficients as described here (thanks Google): j=y0 ; k=-3y0+3y1 ; l=3y0-6y1+3y2 ; m= -y0+3y1-3y2+y3 ... where y0,1,2,3 are the Y coordinates of the (transformed) start point, CP1, CP2 and endpoint respectively. - To find points of intersection, find the solutions for t in jt³+kt²+lt+m = 0. If there are no solutions for t between 0 and 1 then there are no intersections. If there are, then put that value of t back into the equation for the original (untransformed) curve in order to find the actual points of intersection – because your line will only be a line segment, you then need to check that this point is actually on the line and not off the end.
  10. Vector Projection Length

    I guess it's showing you how to project into units of w? It isn't clear though. The length (in world coordinates) of that line segment is |v| cos theta.
  11. Sphere - Plane Collision Response Problem

    When you bounce you are applying gravity for the downward part of the timestep but not the upward part.
  12. I use 4 bytes for my socket library, but that's really just a case of 'might as well'. 2 bytes (65536 unique IDs) should be enough for most things.
  13. Make unit Flee from enemies

    Your thought process is conceptually correct (move away from the average direction of the enemies), but you are failing because of using integers to specify directions. You need to use a vector average and then pick the 8-direction direction to move in that is closest to that. I also recommend that you use a weight based on the inverse of the distance to each enemy, so you run away from the nearest enemy most strongly.
  14. Implementing Massive levels

    You should use a simple static spatial partitioning system (such as a simple grid, or if that doesn't work for you then some form of density-factored box system) for 'zones' which you then load according to proximity, to make a sensibly sized 'local level' which you can use standard (octree etc) partitioning systems on.
  15. The Quake series are open source, so you can probably find an implementation in there. I wrote some code to do this but it never quite worked due to floating point issues. It worked like this: - for each plane, find the lines of intersection with the other planes - for each line, find the points of intersection with the other lines - choose the smallest closed polygon that those points make (from the 'innermost' of the points on each line) The trouble is that line-line intersections rely on exact hits in 3D and you need to be careful with making the tolerance too big.