Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

126 Neutral

About Ziel

  • Rank
  1.   That's what I figured I'd have to use. I was put off from them because I had to use one in another project I worked on and I had no idea exactly how it worked. I guess I'll have to take the time to learn about them. Thanks!
  2. I'm looking for an API that would allow you to search strings for certain policies. For example, I would want to return strings that have a number pattern of a social security number, xxx-xx-xxxx, or maybe just a keyword(s) search. It would be nice to combine multiple policy searches into one search. Does an API like this exist out there free or paid? Preferably in C#? And if not, could you recommend where I should start looking to implement something like this myself?   Thanks!
  3. Any help guys? I don't understand the orientation matrix. I looked up the perpdot product and apparently it returns a scalar. How do you stick a vector d' and a scalar p into a matrix? !
  4. Probably need to put the .dll's you're using into the same directory as your exe
  5. It is usually not necessary to compute an angle and from that to compute an orientation. Often it is suitable to build the orientation directly from the direction. E.g. if t denotes the target point and a the anchor point of the character, then d := t - a denotes the difference vector from the character to the target, and d' := d / |d| denotes the belonging normalized direction vector. Using the perpDot operator you can get a perpendicular vector to that. E.g. p := perpDot( d' ) = [ d'[sub]y[/sub] -d'[sub]x[/sub] ][sup]t[/sup] is a solution if the positive y is 90° counterclockwise to the positive x axis. With this, the orientation matrix is simply [ d' p ] (assuming that the "forward" vector is located at the first column). Much easier than using angles, isn't it? [/quote] I hate to ask, but would you mind giving a code example of this? Also, I don't understand what the perpendicular dot operator is. >_<
  6. Thanks for your reply! I'll look through all of this tomorrow after work
  7. So what I want to do is to have my main character holding a weapon that aims wherever the mouse is pointing. My solution to this is to find the current position of the mouse, find the angle between that point and the character's current direction vector, and then finally rotate the character's direction vector by that angle to make it point toward the mouse. I've never used vectors in my games before, and I'm running into a problem; namely, my code implementation isn't working Here is my code (C++): //set weapon's direction float angle = m_vDirection.findAngleRadians(mouse); //rotate m_vDirection.rotate(angle); //get angle between weapon direction and 0 degrees Vector2D vectemp; vectemp.x = m_vPosition.x - m_rCamera->x; vectemp.y = m_vPosition.y - m_rCamera->y; float angleFromZero = m_vDirection.findAngleDegrees(vectemp); if(angleFromZero > 360) angleFromZero /= 360; //set image accordingly if((angleFromZero >= 0 && angleFromZero <= 30) || (angleFromZero >= 330 && angleFromZero <= 0)) { currentDirection = RIGHT; } else if(angleFromZero >= 31 && angleFromZero <= 59) { currentDirection = UPRIGHT; } else if(angleFromZero >= 60 && angleFromZero <= 120) { currentDirection = UP; } else if(angleFromZero >= 121 && angleFromZero <= 149) { currentDirection = LEFTUP; } else if(angleFromZero >= 150 && angleFromZero <= 210) { currentDirection = LEFT; } else if(angleFromZero >= 211 && angleFromZero <= 239) { currentDirection = LEFTDOWN; } else if(angleFromZero >= 240 && angleFromZero <= 300) { currentDirection = DOWN; } else if(angleFromZero >= 301 && angleFromZero <= 329) { currentDirection = RIGHTDOWN; } m_pSprite->setClip(clips[currentDirection]); As you can see, I try to find the direction that the weapon is currently pointing by checking the angle between a vector (that I think is) pointing along 0 degrees, and the main character's direction vector. This is the part that I think is really not working. And in actuality, I expect it not to because when I think about it, I feel like there is definitely something wrong with my theory, because I don't know what the origin of these vectors are, which could throw off my whole assumption of the 0-360 degrees being the directions that I think they are. If anyone can tell me what I'm doing wrong, or if I'm going about this problem in the completely wrong way, please help me out! Thanks in advance Here are my implementations for Vector2D::findAngleRadians(), Vector2D::findAngleDegrees(), and Vector2D::rotate() just in case anyone wants to see them: float Vector2D::findAngleRadians(Vector2D& rhs) { float dotProd, lengthLHS, lengthRHS, angleCos; //find dot product dotProd = dot(rhs); //find length of each vector lengthLHS = getLength(); lengthRHS = rhs.getLength(); //find the cosine of the angle angleCos = dotProd / (lengthLHS * lengthRHS); //return angle between the two vectors in radians return acosf(angleCos); } //***************************************************** float Vector2D::findAngleDegrees(Vector2D& rhs) { const double PI = 3.1415926; float dotProd, lengthLHS, lengthRHS, angleCos, angleInRads; //find dot product dotProd = dot(rhs); //find length of each vector lengthLHS = getLength(); lengthRHS = rhs.getLength(); //find the cosine of the angle angleCos = dotProd / (lengthLHS * lengthRHS); //find angle in radians angleInRads = acosf(angleCos); //return angle between the two vectors in degrees return (angleInRads * (180 / PI)); } //***************************************************** Vector2D& Vector2D::rotate(float t) { x = x * cosf(t) - y * sinf(t); y = y * cosf(t) + x * sinf(t); return *this; }
  8. Ziel

    unreal development kit

    Click File->New, then click inside the perspective viewport (the one that shows a world full of black), click the red builder brush (the red box), hit space twice to switch to scaling mode, drag one of the cubes to change the size of the brush, and then click the top left button under CSG on the left toolbar (CSG Add).
  9. Ziel

    Calculus Help!

    It's not meant to be mathematically true, it's meant to be a fun brain teaser .
  10. Ziel

    Calculus Help!

    Anyway, here's what I got for your problems. 1. Simplify (1/x - 1/x)/(x - 2) to (2-x)/(2x^2 - 4x). Next, factor a -1 out of the numerator and a 2x out of the denominator resulting in [-(x - 2)]/[2x(x - 2)]. This simplifies to -1/2x. The limit of -1/2x as x approaches 2 is -1/4. 2. First, multiply out (4 + h)^3. This results in h^3 + 12h^2 + 48h + 64. Which, in the whole problem results in (h^3 + 12h^2 + 48h + 64 - 64)/h. This of course simplifies to h^2 + 12h + 48. The limit of h^2 + 12h + 48 as h approaches 0 is 48. For those that are curious, these answers check out using L'Hopital's rule. Kubapl, if you have any questions, feel free to ask.
  11. Ziel

    Calculus Help!

    L'Hopital's rule is soooo convenient isn't it? However, there's a problem. I assume that he/she is taking Calculus 1, and limits are done a week or two before derivatives. If he/she does not know how to take a derivative of a function, he/she certainly cannot do L'Hopital's rule . Also, most teacher's don't really like L'Hopital's rule to be used (except when they're teaching it) when other methods are possible because it hides what's really going on.
  12. Somehow I turned on a feature in Visual Studio 2005 where, for instance, it shows arrows on every indention, and little *'s in every space. How do I turn this off? Thanks.
  13. 0 errors! Thanks for the help.
  14. Quote:Original post by Juanxo hey again: I have found the error. You cannot create structs like you are doing in your constructor ( {255,255,255}) Also, in your constructor implementation, you need to use std::string, instead of just string Woot, your first solution cut it down to 47 errors! Let me see if I can wade through these and get it working. I'll be back if I can't figure it out. The std::string thing was an isolated error, I have std::string in all other files where it's used. >_<
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!