Posted October 19, 200519 yr Okay. I've got a problem. I'm trying to make my first space 'game' in C++. Excpet, I can't seem to get the algorythm right for movement. Okay. Here's what I've got so far. void BitmapObject::ForceAct(double angle, double force) { double tempx; double tempy; VECTORSTRUCT vector; vector.degrees = angle; vector.power = force; DegreesToVector(&vector); tempx = vector.x; tempy = vector.y; vector.degrees = degrees; vector.power = power; DegreesToVector(&vector); vector.x += tempx; vector.y += tempy; VectorToDegrees(&vector); if (vector.power > maxspeed) vector.power = maxspeed; power = vector.power; degrees = vector.degrees; } VECTORSTRUCT is a structure with four members, Degrees, Power, X and Y. DegreesToVector converts Degrees and Power into the X and Y that the object will travel on a plane for one unit of time. VectorToDegrees converts X and Y to the Degrees and Power. The conversion algorythms work flawlessly, they're not the problem. It's just... this doesn't seem to work. I want to have an object moving along a frictionless surface, that does not move at all, until a force acts on it. The movement algorythm and the drawing algorythms are working. However, when a force acts on this, it just doesn't look right. The object moves at almost right angles, and there seem to be invisible walls that I'm hitting all the time. Any idea why?
October 19, 200519 yr Okay. I've got a problem. I'm trying to make my first space 'game' in C++. Excpet, I can't seem to get the algorythm right for movement. Okay. Here's what I've got so far. void BitmapObject::ForceAct(double angle, double force) { double tempx; double tempy; VECTORSTRUCT vector; vector.degrees = angle; vector.power = force; DegreesToVector(&vector); tempx = vector.x; tempy = vector.y; vector.degrees = degrees; vector.power = power; DegreesToVector(&vector); vector.x += tempx; vector.y += tempy; VectorToDegrees(&vector); if (vector.power > maxspeed) vector.power = maxspeed; power = vector.power; degrees = vector.degrees; } VECTORSTRUCT is a structure with four members, Degrees, Power, X and Y. DegreesToVector converts Degrees and Power into the X and Y that the object will travel on a plane for one unit of time. VectorToDegrees converts X and Y to the Degrees and Power. The conversion algorythms work flawlessly, they're not the problem. It's just... this doesn't seem to work. I want to have an object moving along a frictionless surface, that does not move at all, until a force acts on it. The movement algorythm and the drawing algorythms are working. However, when a force acts on this, it just doesn't look right. The object moves at almost right angles, and there seem to be invisible walls that I'm hitting all the time. Any idea why? this guy has a big forhead
October 20, 200519 yr ill be honest i suck at using c++ go to http://www.bzet.com they have some tutorials u have to make a login and stuff first but they have some shit there that can probably help you sorry i couldnt be any more helpful
October 20, 200519 yr Author Never mind. THis algorythm's not hte problem. It's another one. Degrees = sinh(Degrees); That's what's driving me nuts. I need to get it into degrees, and of course, it's operating in radians. Even when I convert it (I've tested and retested conversion), it just doesn't work...
October 20, 200519 yr I came here ready to post my favorite Vector tutorial for C++. Oh well, It was really handy when I had to do a player loop in CS and had to mess vectors using struct.
October 22, 200519 yr Okay. I've got a problem. I'm trying to make my first space 'game' in C++. Excpet, I can't seem to get the algorythm right for movement. Okay. Here's what I've got so far. void BitmapObject::ForceAct(double angle, double force) { double tempx; double tempy; VECTORSTRUCT vector; vector.degrees = angle; vector.power = force; DegreesToVector(&vector); tempx = vector.x; tempy = vector.y; vector.degrees = degrees; vector.power = power; DegreesToVector(&vector); vector.x += tempx; vector.y += tempy; VectorToDegrees(&vector); if (vector.power > maxspeed) vector.power = maxspeed; power = vector.power; degrees = vector.degrees; } VECTORSTRUCT is a structure with four members, Degrees, Power, X and Y. DegreesToVector converts Degrees and Power into the X and Y that the object will travel on a plane for one unit of time. VectorToDegrees converts X and Y to the Degrees and Power. The conversion algorythms work flawlessly, they're not the problem. It's just... this doesn't seem to work. I want to have an object moving along a frictionless surface, that does not move at all, until a force acts on it. The movement algorythm and the drawing algorythms are working. However, when a force acts on this, it just doesn't look right. The object moves at almost right angles, and there seem to be invisible walls that I'm hitting all the time. Any idea why? This is not some fucking physics fucking programing site. Get a life.
October 26, 200519 yr This is not some fucking physics fucking programing site. Get a life. stop trolling. this is a help forum. :repost: , then u might be nicer.