toony

Members

116

80 Neutral

• Rank
Member
1. Calculating how much to move to some position

[font="Courier New"][size="4"]A^2 + B^2 = C^2 doesnt make u smart, not by a long shot star (read star in revers order)! How about you get your lilprick outurass and into your ignorant mouth then smell your breath. That alone should give you more entertainment than the bs u post on random topics. Thanks for the thumbs down, too bad they didnt program the forum to allow rates below 0! Like i give a pile of shit about some pricks rating me down. It's simple you guys are a bunch of woofters and have no life, only the idiotic crap like rating random people down and providing wrong info. [/size][/font]
2. Calculating how much to move to some position

Let me guess, Distance = DestinationLocation.x - CurrentLocation.x + DestinationLocation.y - CurrentLocation.y? Cant check the code if i dont know what's going on inside GetDistance(). My code shows you up front how i calculate the speed. [code]orig[...] += "everything on this side is the speed!"; [/code]
3. Calculating how much to move to some position

[quote name='Nanoha' timestamp='1309459373' post='4829711'] So you you only wanted to move 1 tile at a time down only one axis at a time (the longest axis)? Or have I misunderstood?[/quote] No, i wanted to move from lets say my position (x: 100, y: 136) to (x: 330, y: 542) "not instantly" in a straight line. try the linked program i provided on this topic and you know what im trying to do. [quote name='ApochPiQ' timestamp='1309459723' post='4829714'] People are trying to [i]help[/i] you here. Being dismissive, rude, and calling it "silliness" is not really polite behaviour. It sure as hell doesn't make me interested in helping you any further.[/quote] Fair enough, but i dont call providing wrong information help (i call it silliness)... My first message was fairly clear to understand, i also provided a working program example of my goal.
4. Calculating how much to move to some position

Ok the code will cap the number to the nearest -1 to 1, but the code will cause the object to move in zigzag form. Thats why my method is important to me. Well i have to have some sort of a divider variable to make sure the object moves in a strait line. I must have something that holds the number of increments it will take to get to the desired destination.I already have it working just wanted to see other approaches, not silliness.
5. Calculating how much to move to some position

[quote name='ApochPiQ' timestamp='1309452901' post='4829649'] I really don't follow your math here. The typical formula is this: new_position = old_position + (speed * (target_position - old_position)) Repeat on X, Y, Z axes. Your math seems to exhibit weirdness, and mixes axes, which I honestly can't unravel... [/quote] new_position = old_position + (speed * (target_position - old_position)) step1: new_position = 100 + (1.0f * (338-100)) step2: = new_position = 338 Now im flying! So much useful info in this forum! mostly from the mod team...
6. Calculating how much to move to some position

I dont want to teleport there!
7. Calculating how much to move to some position

i find it strange that to me your code looks hard to understand. In my code i'm just trying to perfectly move something to another position. And speed/velocity variables contain values that will normaly move ahead of the destination i need. I'll take a closer look at your codes and see where that gets me. And my code might seem weird, but it works and for some reason my code looks easy to figure out for me.

nice!
9. Newbie but not in programming

Ha with opengl you will be set for an interesting task! It's good to know how some trig functions like sin, cos, or arccos maybe, before or while learning opengl (Before!). Once you take some linear algebra books and read up what can be applied to graphics programming (you will know when you read a decent book which parts will help for graphics and which will act as just practice that improve your ability to solve equations). You can watch online videos about linear algebra but they might not explain things well at times so you'll have to use google or a book.
10. Calculating how much to move to some position

I wrote some lines of code to calculate the exact number of pixels needed to increment the position of moving objects (each time around the game loop) in order to get the object to some "x, y" position like "224, 329". Here is my aproach: [code] // float orig[2], dest[2]; // [0] = x, [1] = y positions // path calculation if (dest[0] >= dest[1]) { orig[0] += dest[0] / (dest[1] + (dest[0]-dest[1])); orig[1] += dest[1] / dest[0]; } else { orig[0] += dest[0] / dest[1]; orig[1] += dest[1] / (dest[0] + (dest[1] - dest[0])); } [/code] Is this approach clear enough and efficient in your opinion? The code isn't 100%, it's just a glimpse of the full code but this part is the juicy part !! This code would be used to move a player by clicking on the ground where you want to move, like you see in games like baldurs gate for example.Try [url="http://www.mediafire.com/?z662k7e6c26fi8b"]this[/url] program to see what the code does.
11. Cross product of two vectors not perpendicular!

I changed it to: [code]c[3] = {(a[1]-origin[1])*(b[2]-origin[2]) - (a[2]-origin[2])*(b[1]-origin[1]), (a[2]-origin[2])*(b[0]-origin[0]) - (a[0]-origin[0])*(b[2]-origin[2]), (a[0]-origin[0])*(b[1]-origin[1]) - (a[1]-origin[1])*(b[0]-origin[0])};[/code] It is perpendicular but the x and y values of vector c are both 0 so the perpendicular line isnt really aligned with line a and line b which is what i think i want... Ok thanks very much for clearing this mess up! It looks like by default the cross product takes into account the x:0, y:0, z:0 axis and in order to make it to consider another i had to "translate" subtract the contents of the line origin from the line vectors a & b.
12. Cross product of two vectors not perpendicular!

[quote name='SiCrane' timestamp='1309207259' post='4828396'] No, c is perpendicular to a and b. Check the dot products. Did you want (a - origin) x (b - origin) instead? [/quote] Oh! so I have to take away the contents of origin from both a and b, then get the cross product of that! Thanks I'll try this now. Will get back with results.
13. Cross product of two vectors not perpendicular!

I'm trying to use the cross product of two 3d vectors but the result is not a perpendicular line like the linear algebra instructor explained. I'm a bit confused on how to get this working with the c code below. [code] GLfloat origin[3] = {10.0f, 10.0f, 1.0f}, a[3] = {25.0f, 10.0f, 1.0f}, b[3] = {10.0f, 25.0f, 1.0f}, c[3] = {a[1]*b[2] - a[2]*b[1], // cross product of a & b! a[2]*b[0] - a[0]*b[2], a[0]*b[1] - a[1]*b[0]}; glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINES); glColor3f(0.0f, 1.0f, 0.0f); glVertex3fv(origin); glVertex3fv(a); glColor3f(0.0f, 0.0f, 1.0f); glVertex3fv(origin); glVertex3fv(b); glColor3f(1.0f, .0f, .0f); glVertex3fv(origin); glVertex3fv(c); glEnd(); [/code] As it is right now the resulting vector is: [quote]vector c x:-15.000000 y:-15.000000 z:525.000000[/quote] Thanks for any help.
14. If vs. While

while is a loop contition, if is a one timer condition!
15. Worth beginning with dx9?

Try opengl it's a very... procedural api for creating graphics.