Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Oct 2011
Offline Last Active Apr 27 2014 03:53 AM

Topics I've Started

Character Rotation to direction of movement

18 April 2013 - 11:33 AM



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);


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?




Octree Partition Setting

12 February 2013 - 08:37 AM

Hey guys,


I've been staring at this problem for a few hours now, so my brain is a bit bleh sad.png


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 smile.png




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

Sorting a Linked List

11 October 2012 - 11:44 AM

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.


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?

Jump Feature Breaking My Game?

30 September 2012 - 01:10 PM

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,

Analog Xbox Controls

11 June 2012 - 01:06 AM

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