YOUREWINNER.COM
 
   

Me Working on the Game
 
Thunder
#1 30-07-2009, 15:51:52 PM

Help? I'm not understanding these formulas. Slope to degrees would be awesome, if anyone knows the formula. Anyone?


yourethunder
Thunder
#2 30-07-2009, 15:57:01 PM
I already said it. Slope to degrees. I want to emulate BROTRR's awesome physics.


yourethunder
Cirus
#3 30-07-2009, 16:05:48 PM
  • Administrator
  • *****
    *****
    *****
    *****
    *****
    *****
  • Posts: 17614
  • Rigcoins: 9811966.49
  • Send Money to Cirus
    Thumb Up
  • smug hipsterHead Cynic/Obscure MetalheadProfessional Football Manager+
Yes I'm sure that this graph you posted from Wikipedia is extremely relevant.


cirus_
Thunder
#4 30-07-2009, 16:13:39 PM
Yes I'm sure that this graph you posted from Wikipedia is extremely relevant.
Cirus, just take a look at that graph. Look at it. I don't understand the formulas on it, but it's a perfect representation of what I'm trying to do. Notice how the line rotates to match the angle of the slope it's resting on.

Now imagine the same thing but with the line not rotating, only positioning itself on the terrain. That's where I am now, in contrast to BROTRR, which rotates the rigs according to the angle of the ground beneath them. Now, calculating the slope is no problem.
Code: [Select]
((y2#-y1#)/(x2#-x1#))Given that as a variable, how would I find the degree measure equivalent to that?


yourethunder
Dissident
#5 30-07-2009, 16:23:29 PM
  • the ultimate, the muffin man
  • Administrator
  • *****
    *****
    *****
    *****
    *****
    *****
  • Posts: 17638
  • Rigcoins: 99833079.59
  • Send Money to Dissident
    Thumb Up
  • weeaboosexual orientation uncleardissident b shirt+
  • "smash the patriarchy"
tan(degrees) = rise/run

basic trig, although I will admit I googled it.  Which took all of 5 seconds to find.




Dissident International Anti-Furry Organization
Thunder
#6 30-07-2009, 16:30:00 PM
So ang#=atan((y2#-y1#)/(x2#-x1#))?


yourethunder
Thunder
#7 30-07-2009, 16:31:26 PM
THX GUYZ!!1


yourethunder
Thunder
#8 30-07-2009, 17:05:09 PM
It's fcked up, man!


yourethunder
Thunder
#9 30-07-2009, 17:16:51 PM
looks like it needs rotating by 180 degrees along the z axis, so maybe if you added something to the formula to accommodate that.
Nope, rotation is completely random. Afterwards, I tweaked it a little and got a BROTRR-themed strobelight.

EDIT: Oh. Well, I could try the abs() function like you said. 1 sec.


yourethunder
Thunder
#10 30-07-2009, 17:20:50 PM
Tried it. Nope, didn't work. What if I send you a pre-pre-alpha demo?


yourethunder
Thunder
#11 30-07-2009, 17:30:20 PM
Thunder
#12 30-07-2009, 17:52:21 PM
Is this something you've coded yourself or does it run off an existing engine?
Coded it myself. The highest level thing below my own code is DarkBASIC, which is basically an interpreter based on DirectX.


yourethunder
Thunder
#13 30-07-2009, 17:57:36 PM
So, out of all of the following code, what do you think is wrong?
Code: [Select]
acc#=0.5
ts#=6.0
maxr#=10.0
f#=0.0

do

    r#=(f#/ts#)*maxr#
    if rightkey() then yrotate object 1,wrapvalue(object angle y(1)+r#)
    if leftkey() then yrotate object 1,wrapvalue(object angle y(1)-r#)
    if upkey() then f#=f#+acc#
    if downkey() then f#=f#-acc#
    move object 1,f#
    f#=curvevalue(0.0,f#,ts#)

    x#=object position x(1)
    y#=object position y(1)
    z#=object position z(1)
    col=intersectObjectDBC(0,0,x#,255.0,z#,x#,0.0,z#,1)
    position object 1,x#,getStaticCollisionY(),z#
    rotate object 1,angle#(y#,getCollisionNormalY(),z#,getCollisionNormalZ()),object angle y(1),angle#(x#,getCollisionNormalX(),y#,getCollisionNormalY())
    set camera to follow x#,y#,z#,object angle y(1),object size z(1)*2.0,y#+(object size y(1)*2.0),5,0
    point camera x#,y#,z#
    position object 65535,camera position x(),camera position y(),camera position z()
    if escapekey() then pause=1
    if pause
        center text 400,300,"QUIT TO WINDOWS? Y/N"
        if lower$(inkey$())="y" then end
        if lower$(inkey$())="n" then pause=0
    endif
    sync
loop

function angle#(x1#,x2#,y1#,y2#)
    result#=wrapvalue(atan(abs((y2#-y1#)/failsafe#(x2#-x1#))))
endfunction result#

function failsafe#(result#)
    if result#=0 then result#=.0000000000000000000000000000000000000000001
endfunction result#


yourethunder
O-ZONE
#14 30-07-2009, 18:41:16 PM
well who needs school for math when you can learn from :brbox: instead!!!!!!!!!!!!!!!!!


Thunder
#15 30-07-2009, 18:52:05 PM
well who needs school for math when you can learn from :brbox: instead!!!!!!!!!!!!!!!!!
But BROTRR isn't open-source, so how am I supposed to extract the answers to the mysteries within?


yourethunder
0 Members and 1 Guest are viewing this topic.