• Content count

  • Joined

  • Last visited

Community Reputation

340 Neutral

About MrChrisnis

  • Rank
  1. Character Rotation to direction of movement

    Ahhh, thank you for the extra explanation. Now I just need to try to remember that for the future :P   The code is now working properly and my character rotates as expected.
  2. Character Rotation to direction of movement

    Oh wow, I totally should have known that...   Thanks again for the help. I feel really stupid right now :D
  3. Character Rotation to direction of movement

    Hi,   Thanks for your reply so fast.   I have the stuff you mentioned in your Edit for my velocity setting. The problem was just getting the character to rotate to face the way it is moving.   In regards to the atan2, what would I actually be using for the parameters of that function?   Sorry, I've just been trying to get this rotation working for quite a while now and staring at it makes me annoyed now :(   Thanks, Chris
  4. Hi,   I have got my character to rotate so that it faces the direction that it will be moving when the W key is pressed, however this only works for a certain amount to each side. I cannot turn my camera 180 degrees and have the character follow it. The code I am using is shown below.   void Game::calcRotAngle(Model *p) { float dot = xAxis.DotProduct(heading); float theta = acos(dot); float angle = theta * 180/PI; p->rotAngleZ = -angle; /*char text[256]; sprintf_s(text, "Angle: %5f", angle); DebugOut(text);*/ }   The "heading" Vector is calculated from the position the camera is looking at - the camera's eye position to get the forward vector for where the camera is looking.   Can anybody help me to understand why this isn't working as I want it to?   Thanks, Chris
  5. Octree Partition Setting

    Hey guys,   I've been staring at this problem for a few hours now, so my brain is a bit bleh   I have a program with cubes with collision spheres inside of a game domain. I am using an Octree to perform the collision checking however I seem to have run into a "bug" with the way I have implemented it. If any of the cube's collision spheres overlap on any of the axes (have a 0 for any of their axial position values) then that cube is pushed back up to the root and left there as it cannot filter down to lower partitions while it is on the axis. This is causing the number of objects in the root of my Octree to be abnormally high for what I am expecting to be the outcome.   I *THINK* that I have narrowed the "bug" down to the following piece of code:   bool BinPart::contains(Cube3D* obj) { float lX = obj->getPos().x - obj->getColRadius(); float hX = obj->getPos().x + obj->getColRadius(); float lY = obj->getPos().y - obj->getColRadius(); float hY = obj->getPos().y + obj->getColRadius(); float lZ = obj->getPos().z - obj->getColRadius(); float hZ = obj->getPos().z + obj->getColRadius(); return(lX > lowX && hX < highX && lY > lowY && hY < highY && lZ > lowZ && hZ < highZ); }   It seems that the return statement in that function will never return true if an object is on any axis, however I fail to see how I could change this so that only objects that are touching (0, 0, 0) will be in the root, while objects that are only on one axis are placed into parent nodes.   Any help would be greatly appreciated Thanks Chris   P.S - Sorry if the code doesn't come out properly. Couldn't remember how to correctly add C++ code in with the colour formatting and everything
  6. Sorting a Linked List

    Hmm, that mistake isn't in my code =S Copy and paste fail ftw. I fixed the problem I had (Needed a return call added after b->set_next(next); in the first if statement), and have run into another. Time to go try to figure that out. And I have to do it this way as it is an assignment that I am working on and my lecturer wants it done this way
  7. I Need Help.

    While C++ is a hard language, don't let that discourage you if you truly want to start there, just prepare to be in for a lot of hard work if you are teaching yourself
  8. Sorting a Linked List

    Okay, I've tried implementing my own insertion sorting after writing it out, and it is still confusing me. This causes the program to pretty much break after one Beast has been inserted into the list. It doesn't break out or crash or anything like that, it just stops outputting the command line requests that it is supposed to and stop allowing the user to enter in any more inputs. If you guys could look through it and give me some hints on how I can fix this it would be great [img][/img] Thanks, Chris P.S - I have tried! [img][/img] EDIT: My code is displaying in this post as though it is on one long line. I am not sure how to fix this or if it is showing like this for other people so I am sorry if it is
  9. Sorting a Linked List

    Thanks for all the replies so far guys. Taking a little break because I've been staring at this stuff for a while now and it's just like *boom, head explode* [img][/img] My list relies on the user adding the data in themselves, therefore there is nothing in the list to start with, so would it be better for me to amend my add/add_to_end functions to sort the objects as they are added in?
  10. Sorting a Linked List

    Hey guys, Right now I am creating a linked list and performing certain functions on it, however I am stuck at one point. I can get the list to display it's elements, however I am trying to figure out how to display the elements in a sorted order. My list contains objects that contain a name and a health variable. I am trying to sort the name alphabetically, and the health numerically (obviously as separate calls). I have searched for replies about this on these forums, but knowing nothing about different sorting algorithms myself, it is quite hard to understand what is going on in some of the replies. Any help that you guys can give, or any "dumbed down" explanations would be great. Thanks, Chris P.S - Would it be better to have a separate Node class that the Object class inherits, or just implement the node functions into the Object class itself?
  11. Jump Feature Breaking My Game?

    Thanks guys for the help. I am looking through to see if I can change it to get it working with the help you guys have posted. As for the poor programming, sadly that is the way I have been taught to program up until now. My lecturer said that first year was just a "get it work no matter what the code is like" year, and that during this year, my second year, we learn why certain programming methods are better than others (Currently doing Data Structures and Software Engineering modules so they should help). I shall also look through that angelfire link that was posted and see what I can learn [img][/img] Up until now with this work, I have just been following through the worksheets we are given and doing what they say each week. I wish I could do more but baby steps eh? Anyways, thank you again for your help with this [img][/img] EDIT: Forgot to add @EngineProgrammer, yes. I have the SDL Files separate from my project and I link to them in the properties
  12. Jump Feature Breaking My Game?

    [size=4][code] //The Jump Function void Player::jump() { set_velocities(0, -30); set_auto_move(40); set_y_acceleration(9.8); set_auto_accelerate(40); } //Which is stopped by this to stop the if(player->get_y() > 300) { player->set_y_velocity(0); player->set_y_acceleration(0); player->set_world_position_y(300); isJumping = false; } //The screen collision code is just put in with the SDK_KEYDOWN stuff case SDLK_LEFT: if(player->get_x() >= 10) player->moveHorizontally(-10); break; case SDLK_RIGHT: if(player->get_x() + player->get_width() <= 630) player->moveHorizontally(10); break; [size=4]//And the moveHorizontally function void Player::moveHorizontally(float speed) { set_velocities(speed, 0); move(); } [/code][/size]
  13. Jump Feature Breaking My Game?

    Hey guys, In one of my classes we are doing Scrolling backgrounds and general sprite movement stuff. Up until now everything has worked properly, however when I put in a jump feature, it seems to cause problems when the player jumps. Before jumping, the player will be confined within the sides of the screen when moving left/right, however after the player jumps, the confines of the screen seem to break and the player moves at a higher pace than they are supposed to when moving side to side. The code is attached to this post. Any help would be appreciated, Thanks Chris
  14. Hi guys I know this really should be on the epicgames UDK forums (I have posted there but have not received a reply) but I was trying to figure out how to get UDK to register my Trigger inputs on an xbox controller as Analog rather than Digital. I have tried to follow a few guides on google and stuff, but none of them seem to have worked (Might have been me doing something wrong, I have been using UnrealScript for a grand total of 5 days now because its for a project that ends on Tuesday =/) If anybody would be able to assist me with this then I would be very grateful Thanks Chris
  15. SDL Splash Screens

    Hi, I have an SDL game with a splash screen on right now, but for my splash screen I have created a new SDL_Event and a while loop for the splash screen separate to that of the game loop. I was just wondering if there is an easier way of creating the splash screen as right now the game requires two presses of Escape of the X button to quit out (Which I am guessing is because of the loop not properly closing?) Thanks Chris