I keep forgetting about this post. =D
Anyways, an up-to-date zip is attached, and here's the code:
#Constant TYPE_NGC_ELLIP=1
#Constant TYPE_NGC_MESH=2
#Constant ELLIP_2_ELLIP=1
#Constant ELLIP_2_POLY=2
#Constant RESP_STICK=1
#Constant RESP_SLIDE=2
#Constant RESP_SLIDE_NO_SLOPES=6
#Constant RESP_SLIDE_NO_GRAV=10
#Constant RESP_SLIDE_NO_ACCEL=18
#Constant RESP_NONE=32
#Constant DYN_NO_RESP=1
#Constant DYN_RESP=2
#Constant DYN_RESP_LOCK=4
#Constant DYN_RESP_LOCK_NOTURN=12
#Constant NCULL_CLOCK=0
#Constant NCULL_COUNTER_CLOCK=1
#Constant NCULL_NONE=2
gosub load_main
gosub init_vars
gosub load_level
do
gosub update
gosub debug_data
sync
if escapekey() then exit
loop
gosub unload_level
gosub unload_main
end
load_main:
sync on
sync rate 30
hide mouse
autocam off
disable escapekey
StartCollisionPRO(615283733,241748411,352432579)
StartCollisionDebugPRO()
return
init_vars:
type xyzset
x as double float
y as double float
z as double float
endtype
velocity as xyzset
spin as xyzset
position as xyzset
normal as xyzset
normal_adj as xyzset
rotation as xyzset
camera_offset as xyzset
bounce as xyzset
vel_target1 as xyzset
vel_target2 as xyzset
vel_difference1 as xyzset
vel_difference2 as xyzset
spin_target1 as xyzset
spin_target2 as xyzset
spin_difference1 as xyzset
spin_difference2 as xyzset
spin2vel as double float
vel2spin as double float
camera_distance as integer
camera_position as xyzset
cam_speed as integer
minimap_height as integer
friction as double float
jumpforce as double float
gravity as xyzset
bounce_ease as xyzset
speed as double float
total_speed as double float
`acceleration as double float
`decceleration as double float
`acceleration=4
`decceleration=32
cam_speed=1
camera_distance=50
minimap_height=200
friction=.99
`friction=.000001
jumpforce=5
gravity.y=.3
gravity.x=0
gravity.z=0
speed=4
spin2vel=4
vel2spin=4
return
load_level:
make object cube 4,1
hide object 4
make object cube 5,1
hide object 5
sprite3D(3,128,128,screen width()-130,2)
load image "minimap mask.png",3
make camera 2
color backdrop 2,0
set camera aspect 2,1
set camera to image 2,4,128,128
texture object 3,0,4
set blend mapping on 3,1,3,3,4
ghost object on 3,0
set object light 3,0
load image "speedometer.png",5
sprite 1,2,screen height()-130,5
load image "needle.png",6
sprite 2,2+64,screen height()-130+64,6
set sprite priority 2,1
load object "marble.3ds",1
if file exist("testlevel2.3ds")
load object "testlevel2.3ds",2
else
load object "testlevel.3ds",2
endif
load image "texture.jpg",1
texture object 1,1
texture object 2,1
ink 0,rgb(255,255,255)
#CONSTANT type_marble=1
#CONSTANT type_level=2
#CONSTANT type_platform=3
#CONSTANT type_camera=4
#CONSTANT obj_marble=1
#CONSTANT obj_level=2
SetCollisionsPRO(type_marble,type_level,ellip_2_poly,resp_slide,dyn_resp)
SetCollisionsPRO(type_marble,type_platform,ellip_2_poly,resp_slide,dyn_resp_lock)
SetCollisionsPRO(type_camera,type_level,ellip_2_poly,resp_stick,dyn_resp)
SetCollisionsPRO(type_camera,type_platform,ellip_2_poly,resp_stick,dyn_resp)
CollisionTypePRO(1,type_marble)
CollisionTypePRO(2,type_level)
CollisionTypePRO(4,type_camera)
CollisionTypePRO(5,type_camera)
SetObjRadiusPRO(1,5,5,5)
position object 1,0,15,0
position object 2,0,0,0
make camera 1
position camera 1,0,105,100
point camera 1,0,5,0
set ambient light 30
set camera range 1,.01,3000
RunCollisionPRO()
return
update:
if keystate(2) then dec minimap_height
if keystate(3) then inc minimap_height
`normals
normal.x=0
normal.y=0
normal.z=0
normal_adj.x=0
normal_adj.y=0
normal_adj.z=0
hits=CountCollisionsPRO(1)
if hits>0
for c=0 to hits-1
normal.x=normal.x+CollisionHitNormPRO(1,c,1)
normal.y=normal.y+CollisionHitNormPRO(1,c,2)
normal.z=normal.z+CollisionHitNormPRO(1,c,3)
next c
`normal.x=normal.x/hits
`normal.y=normal.y/hits
`normal.z=normal.z/hits
normal_adj.x=normal.x/hits
normal_adj.y=normal.y/hits
normal_adj.z=normal.z/hits
endif
rotation.x=object angle x(1)
rotation.y=object angle y(1)
rotation.z=object angle z(1)
if returnkey()
velocity.x=0
velocity.y=0
velocity.z=0
spin.x=0
spin.z=0
position.x=0
position.y=15
position.z=0
position object 1,position.x,position.y,position.z
ResetObjPRO(1)
normal.x=0
normal.y=0
normal.z=0
bounce.x=0
bounce.y=0
bounce.z=0
rotation.x=0
rotation.y=0
rotation.z=0
camera_offset.y=0
camera_offset.x=0
endif
if upkey()
spin.z=spin.z-cos(camera_offset.y)*speed
spin.x=spin.x+sin(camera_offset.y)*speed
endif
if downkey()
spin.z=spin.z+cos(camera_offset.y)*speed
spin.x=spin.x-sin(camera_offset.y)*speed
endif
if rightkey()
spin.x=spin.x-cos(camera_offset.y)*speed
spin.z=spin.z-sin(camera_offset.y)*speed
endif
if leftkey()
spin.x=spin.x+cos(camera_offset.y)*speed
spin.z=spin.z+sin(camera_offset.y)*speed
endif
if keystate(17)
camera_offset.x=camera_offset.x+cam_speed
endif
if keystate(30)
camera_offset.y=camera_offset.y-cam_speed
endif
if keystate(31)
camera_offset.x=camera_offset.x-cam_speed
endif
if keystate(32)
camera_offset.y=camera_offset.y+cam_speed
endif
camera_offset.x=camera_offset.x+mousemovey()/5
camera_offset.y=camera_offset.y-mousemovex()/5
camera_distance=camera_distance+(mousez()-lmousez)/5
lmousez=mousez()
if keystate(16) then camera_distance=camera_distance+1
if keystate(18) then camera_distance=camera_distance-1
`spin marble
ezro_seteuler rotation.x,rotation.y,rotation.z
ezro_gx spin.x
ezro_gz spin.z
ezro_findeuler
rotate object 1,ezro_geteulerx(),ezro_geteulery(),ezro_geteulerz()
`friction
velocity.x=velocity.x*friction
velocity.y=velocity.y*friction
velocity.z=velocity.z*friction
spin.x=spin.x*friction
spin.y=spin.y*friction
spin.z=spin.z*friction
remstart
velocity.x=curvevalue(velocity.x,0,velocity.x-velocity.x^2*friction)
velocity.y=curvevalue(velocity.y,0,velocity.y-velocity.y^2*friction)
velocity.z=curvevalue(velocity.z,0,velocity.z-velocity.z^2*friction)
spin.x=curvevalue(spin.x,0,spin.x^2*friction)
spin.y=curvevalue(spin.y,0,spin.y^2*friction)
spin.z=curvevalue(spin.z,0,spin.z^2*friction)
remend
`gravity
`velocity.y=velocity.y-gravity*(1-int(normal.y+.5))
velocity.y=velocity.y-gravity.y*(1-normal.y)
velocity.x=velocity.x-gravity.x*(1-normal.x)
velocity.z=velocity.z-gravity.z*(1-normal.z)
`bounce
bounce.x=velocity.x*abs(normal.x)*-1.9
bounce.y=velocity.y*abs(normal.y)*-1.9
bounce.z=velocity.z*abs(normal.z)*-1.9
`bounce_ease=int(2.0/abs(normal.y-(abs(normal.x)+abs(normal.z))))
`bounce.x=int(bounce.x/bounce_ease)*bounce_ease
`bounce.y=int(bounce.y/bounce_ease)*bounce_ease
`bounce.z=int(bounce.z/bounce_ease)*bounce_ease
`bounce_ease.x=abs(2.0/abs(normal.x))
`bounce_ease.y=abs(2.0/abs(normal.y))
`bounce_ease.z=abs(2.0/abs(normal.z))
bounce_ease.x=int(1.0/abs(normal_adj.x-(abs(normal_adj.y)+abs(normal_adj.z))))
bounce_ease.y=int(3.0/abs(normal_adj.y-(abs(normal_adj.x)+abs(normal_adj.z))))
bounce_ease.z=int(1.0/abs(normal_adj.z-(abs(normal_adj.x)+abs(normal_adj.y))))
bounce.x=int(bounce.x/bounce_ease.x)*bounce_ease.x
bounce.y=int(bounce.y/bounce_ease.y)*bounce_ease.y
bounce.z=int(bounce.z/bounce_ease.z)*bounce_ease.z
velocity.x=velocity.x+bounce.x
velocity.y=velocity.y+bounce.y
velocity.z=velocity.z+bounce.z
if spacekey() or mouseclick()
velocity.y=velocity.y+(jumpforce*normal_adj.y)
velocity.x=velocity.x+(jumpforce*normal_adj.x)
velocity.z=velocity.z+(jumpforce*normal_adj.z)
endif
vel_target1.x=(spin.z*-.08) `*normal.y
vel_target1.z=(spin.x*.08) `*normal.y
vel_target1.y=(spin.x*-.08) `*normal.z
vel_target2.y=(spin.z*.08) `*normal.x
vel_difference1.x=vel_target1.x-velocity.x `*normal.y
vel_difference1.z=vel_target1.z-velocity.z `*normal.y
vel_difference1.y=vel_target1.y-velocity.y `*normal.z
vel_difference2.y=vel_target2.y-velocity.y `*normal.x
spin_target1.x=velocity.z/.08 `*normal.y
spin_target1.z=velocity.x/-.08 `*normal.y
spin_target2.x=velocity.y/-.08 `*normal.z
spin_target2.z=velocity.y/.08 `*normal.x
spin_difference1.x=spin_target1.x-spin.x `*normal.y
spin_difference1.z=spin_target1.z-spin.z `*normal.y
spin_difference2.x=spin_target2.x-spin.x `*normal.z
spin_difference2.z=spin_target2.z-spin.z `*normal.x
velocity.x=velocity.x+vel_difference1.x*abs(normal_adj.y)/spin2vel
velocity.z=velocity.z+vel_difference1.z*abs(normal_adj.y)/spin2vel
velocity.y=velocity.y+vel_difference1.y*abs(normal_adj.z)/spin2vel
velocity.y=velocity.y+vel_difference2.y*abs(normal_adj.x)/spin2vel
spin.x=spin.x+spin_difference1.x/abs(normal_adj.y)/vel2spin
spin.z=spin.z+spin_difference1.z/abs(normal_adj.y)/vel2spin
spin.x=spin.x+spin_difference2.x/abs(normal_adj.z)/vel2spin
spin.z=spin.z+spin_difference2.z/abs(normal_adj.x)/vel2spin
remstart
if normal_adj.y>0 then velocity.x=velocity.x+vel_difference1.x*abs(normal_adj.y)/spin2vel else velocity.x=velocity.x-vel_difference1.x*abs(normal_adj.y)/spin2vel
if normal_adj.y>0 then velocity.z=velocity.z+vel_difference1.z*abs(normal_adj.y)/spin2vel else velocity.z=velocity.z-vel_difference1.z*abs(normal_adj.y)/spin2vel
if normal_adj.z>0 then velocity.y=velocity.y+vel_difference1.y*abs(normal_adj.z)/spin2vel else velocity.y=velocity.y-vel_difference1.y*abs(normal_adj.z)/spin2vel
if normal_adj.x>0 then velocity.y=velocity.y+vel_difference2.y*abs(normal_adj.x)/spin2vel else velocity.y=velocity.y-vel_difference2.y*abs(normal_adj.x)/spin2vel
if normal_adj.y>0 then spin.x=spin.x+spin_difference1.x/abs(normal_adj.y)/vel2spin else spin.x=spin.x-spin_difference1.x/abs(normal_adj.y)/vel2spin
if normal_adj.y>0 then spin.z=spin.z+spin_difference1.z/abs(normal_adj.y)/vel2spin else spin.z=spin.z-spin_difference1.z/abs(normal_adj.y)/vel2spin
if normal_adj.z>0 then spin.x=spin.x+spin_difference2.x/abs(normal_adj.z)/vel2spin else spin.x=spin.x-spin_difference2.x/abs(normal_adj.z)/vel2spin
if normal_adj.x>0 then spin.z=spin.z+spin_difference2.z/abs(normal_adj.x)/vel2spin else spin.z=spin.z-spin_difference2.z/abs(normal_adj.x)/vel2spin
remend
`spin -> velocity
`C/360=.087266462599716478846184538424431
`.087266462599716478846184538424431 = about .08
`velocity.y=velocity.y+vel_difference.y/acceleration*(abs(normal_adj.x)+abs(normal_adj.z))
`spin_target.x=velocity.z/.08+velocity.y/-.08
`spin_target.z=velocity.x/-.08+velocity.y/.08
`spin_difference.x=spin_target.x-spin.x
`spin_difference.z=spin_target.z-spin.z
remstart
velocity.x=velocity.x+vel_difference1.x/acceleration*abs(normal_adj.y)
velocity.z=velocity.z+vel_difference1.z/acceleration*abs(normal_adj.y)
velocity.y=velocity.y+vel_difference1.y/acceleration*abs(normal_adj.z)
velocity.y=velocity.y+vel_difference2.y/acceleration*abs(normal_adj.x)
spin.x=spin.x+(spin_difference1.x*abs(normal_adj.y)+spin_difference2.x*abs(normal_adj.z))/acceleration
spin.z=spin.z+(spin_difference1.z*abs(normal_adj.y)+spin_difference2.z*abs(normal_adj.x))/acceleration velocity.x=velocity.x+vel_difference1.x/acceleration*abs(normal_adj.y)
remend
remstart
velocity.x=velocity.x+vel_difference1.x*abs(normal_adj.y)/spin2vel
velocity.z=velocity.z+vel_difference1.z*abs(normal_adj.y)/spin2vel
velocity.y=velocity.y+vel_difference1.y*abs(normal_adj.z)/spin2vel
velocity.y=velocity.y+vel_difference2.y*abs(normal_adj.x)/spin2vel
spin.x=spin.x+spin_difference1.x/abs(normal_adj.y)/vel2spin
spin.z=spin.z+spin_difference1.z/abs(normal_adj.y)/vel2spin
spin.x=spin.x+spin_difference2.x/abs(normal_adj.z)/vel2spin
spin.z=spin.z+spin_difference2.z/abs(normal_adj.x)/vel2spin
remend
remstart
target.x=spin.z*normal.y*-.09
target.z=spin.x*normal.y*.09
target.y=(spin.x*normal.z*-.09)+(spin.z*normal.x*.09)
difference.x=target.x-velocity.x
difference.z=target.z-velocity.z
difference.y=target.y-velocity.y
velocity.x=velocity.x+difference.x/acceleration*abs(normal.y)
velocity.z=velocity.z+difference.z/acceleration*abs(normal.y)
velocity.y=velocity.y+difference.y/acceleration*(abs(normal.x)+abs(normal.z))
spin.z=(spin.z-spin.z/decceleration*abs(normal.y))-spin.z/decceleration*(abs(normal.x)+abs(normal.z))
spin.x=(spin.x-spin.x/decceleration*abs(normal.y))-spin.x/decceleration*(abs(normal.x)+abs(normal.z))
remend
`movement
position.x=position.x+velocity.x
position.y=position.y+velocity.y
position.z=position.z+velocity.z
camera_offset.y=wrapvalue(camera_offset.y)
camera_offset.x=wrapvalue(camera_offset.x)
if camera_offset.x>89 and camera_offset.x<271
if camera_offset.x<180 then camera_offset.x=89
if camera_offset.x>=180 then camera_offset.x=271
endif
position object 1,position.x,position.y,position.z
`RunObjCollisionPRO(2)
camera_position.x=object position x(1)-cos(camera_offset.y)*cos(camera_offset.x)*camera_distance
camera_position.y=object position y(1)+sin(camera_offset.x)*camera_distance
camera_position.z=object position z(1)-sin(camera_offset.y)*cos(camera_offset.x)*camera_distance
`position object 4,object position x(1),object position y(1),object position z(1)
`point object 4,object position x(1),object position y(1)+minimap_height,object position z(1)
`ResetObjPro(4)
`move object 4,minimap_height-10
`position object 5,object position x(1),object position y(1),object position z(1)
`point object 5,camera_position.x,camera_position.y,camera_position.z
`ResetObjPro(5)
`move object 5,camera_distance-10
RunCollisionPRO()
position.x=object position x(1)
position.y=object position y(1)
position.z=object position z(1)
position camera 1,object position x(1)-cos(camera_offset.y)*cos(camera_offset.x)*camera_distance,object position y(1)+sin(camera_offset.x)*camera_distance,object position z(1)-sin(camera_offset.y)*cos(camera_offset.x)*camera_distance
`position camera 1,object position x(5),object position y(5),object position z(5)
point camera 1,object position x(1),object position y(1),object position z(1)
`position camera 2,object position x(4),object position y(4),object position z(4)
position camera 2,object position x(1),object position y(1)+minimap_height,object position z(1)
point camera 2,camera position x(2),camera position y(2)-128,camera position z(2)
yrotate camera 2,wrapvalue(90-camera_offset.y)
`total_speed=sqrt(velocity.x^2+sqrt(velocity.y^2+velocity.z^2)^2)
`total_speed=sqrt(velocity.x^2+velocity.z^2)
total_speed=sqrt(velocity.x^2+velocity.z^2)*0.1+total_speed*0.9
rotate sprite 2,(total_speed*27)-270
return
`DEBUG DATA OUTPUT
debug_data:
if keystate(71) then speed=speed+1:while scancode():endwhile
if keystate(75) then speed=speed-1:while scancode():endwhile
if keystate(72) then spin2vel=spin2vel*2:while scancode():endwhile
if keystate(76) then spin2vel=spin2vel/2:while scancode():endwhile
if keystate(73) then vel2spin=vel2spin*2:while scancode():endwhile
if keystate(77) then vel2spin=vel2spin/2:while scancode():endwhile
`if keystate(72) then acceleration=acceleration+1:while scancode():endwhile
`if keystate(76) then acceleration=acceleration-1:while scancode():endwhile
`if keystate(73) then decceleration=decceleration*2:while scancode():endwhile
`if keystate(77) then decceleration=decceleration/2:while scancode():endwhile
text 10,10,"Position"
text 10,30,str$(position.x)
text 10,50,str$(position.y)
text 10,70,str$(position.z)
text 10,90,"Velocity"
text 10,110,str$(velocity.x)
text 10,130,str$(velocity.y)
text 10,150,str$(velocity.z)
text 10,170,"Normal"
text 10,190,str$(normal.x)
text 10,210,str$(normal.y)
text 10,230,str$(normal.z)
text 10,250,"Spin"
text 10,270,str$(spin.x)
text 10,290,str$(spin.z)
text 10,310,"Speed: "+str$(speed)
`text 10,330,"Acceleration: "+str$(acceleration)
`text 10,350,"Decceleration: "+str$(decceleration)
text 10,330,"Spin2Vel: "+str$(spin2vel)
text 10,350,"Vel2Spin: "+str$(vel2spin)
text 200,10,"Velocity Difference 1 (xzy)"
text 200,30,str$(vel_difference1.x)+" ny"
text 200,50,str$(vel_difference1.z)+" ny"
text 200,70,str$(vel_difference1.y)+" nz"
text 200,90,"Velocity Difference 2 (y)"
text 200,110,str$(vel_difference2.y)+" nx"
text 200,130,"Spin Difference 1"
text 200,150,str$(spin_difference1.x)+" ny"
text 200,170,str$(spin_difference1.z)+" ny"
text 200,190,"Spin Difference 2"
text 200,210,str$(spin_difference2.x)+" nz"
text 200,230,str$(spin_difference2.z)+" nx"
text 200,250,"Adjusted Normal"
text 200,270,str$(normal_adj.x)
text 200,290,str$(normal_adj.y)
text 200,310,str$(normal_adj.z)
while shiftkey():endwhile
if controlkey() then wait 500
return
unload_level:
delete object 3
delete image 3
delete camera 2
delete image 4
delete object 1
delete object 2
delete image 1
delete sprite 1
delete sprite 2
delete image 5
delete image 6
return
unload_main:
sync off
show mouse
StopCollisionPRO()
return
function sprite3D(spr3d,xSize as integer, ySize as integer, xPos as integer, yPos as integer)
scrW = screen width() : scrW2 = scrW / 2.0
scrH = screen height() : scrH2 = scrH / 2.0
make object plain spr3d, xSize, ySize, 1
position object spr3d, 0-(scrW2-xSize/2.0)+xPos, (scrH2-ySize/2.0)-yPos, ((scrW - scrH) * 2.5)
lock object on spr3d
disable object zwrite spr3d
endfunction
function negRep(num as double float)
if num<0
exitfunction -1
else
exitfunction 1
endif
endfunction 1
In the zip, there are 2 files - marble_debug.exe and marble_nodebug.exe. As you can kind of tell by their names, one has all debug data shown and allows you to use keypad 4,5,6,7,8, and 9 to change what used to be the speed, accel, and deccel values. Now, though, as I've revamped that part of the physics, they are speed, vel2spin, and spin2vel. I suggest keeping vel2spin and spin2vel the same. Also, I'm currently working hard on a very troubling and very elusive new bug introduced by the new implementation of physics in this new version. The bug is that, when ever a normal is negative, the spin and velocity seem to be affected incorrectly, which causes them to increase wildly, making the marble accelerate violently. =D
This means, when looking at the level with the starting camera position, the left wall, the wall you are looking directly towards, and the "ceiling" all cause the ball to spaz out. =D
However, these changes to the physics have made it much more realistically - for example, the marble will now roll down inclines. (you'll get to test that as soon as I fix the bug, because, right now, all ramps are negative normals, so they don't work correctly. =D
If anybody who's really good at physics is looking at this thread, here's the code which is creating the problem:
vel_target1.x=(spin.z*-.08) `*normal.y
vel_target1.z=(spin.x*.08) `*normal.y
vel_target1.y=(spin.x*-.08) `*normal.z
vel_target2.y=(spin.z*.08) `*normal.x
vel_difference1.x=vel_target1.x-velocity.x `*normal.y
vel_difference1.z=vel_target1.z-velocity.z `*normal.y
vel_difference1.y=vel_target1.y-velocity.y `*normal.z
vel_difference2.y=vel_target2.y-velocity.y `*normal.x
spin_target1.x=velocity.z/.08 `*normal.y
spin_target1.z=velocity.x/-.08 `*normal.y
spin_target2.x=velocity.y/-.08 `*normal.z
spin_target2.z=velocity.y/.08 `*normal.x
spin_difference1.x=spin_target1.x-spin.x `*normal.y
spin_difference1.z=spin_target1.z-spin.z `*normal.y
spin_difference2.x=spin_target2.x-spin.x `*normal.z
spin_difference2.z=spin_target2.z-spin.z `*normal.x
velocity.x=velocity.x+vel_difference1.x*abs(normal_adj.y)/spin2vel
velocity.z=velocity.z+vel_difference1.z*abs(normal_adj.y)/spin2vel
velocity.y=velocity.y+vel_difference1.y*abs(normal_adj.z)/spin2vel
velocity.y=velocity.y+vel_difference2.y*abs(normal_adj.x)/spin2vel
spin.x=spin.x+spin_difference1.x/abs(normal_adj.y)/vel2spin
spin.z=spin.z+spin_difference1.z/abs(normal_adj.y)/vel2spin
spin.x=spin.x+spin_difference2.x/abs(normal_adj.z)/vel2spin
spin.z=spin.z+spin_difference2.z/abs(normal_adj.x)/vel2spin
vel_target 1 and 2 are the perfect velocity of the marble if the normal and spin were constant, and spin_target 1 and 2 are the perfect spin of the marble if the normal and velocity were constant.
The reason I have 2 of each of these variables is that I have 2 dimensions of spin (no y spin), and each of which can be affected by 2 dimensions of velocity (aka, not the one they rotate on), and they share one of these dimensions (y), so they way they affect each other maps out like this:
x spin -- z velocity
z spin -- x velocity
x spin -- y velocity
z spin -- y velocity
so, I need 2 x spin variables and 2 z spin variables and 2 y velocity variables.
Then, vel_difference 1 and 2 and spin_difference 1 and 2 are the difference between the currect spin and velocity and the target spin and velocity (spin_target and vel_target). Then, the current values change by a fraction - basically:
relevant normal * (1/spin2vel)
for velocity created by spin and:
relevant normal * (1/vel2spin)
for spin created by velocity.
BTW, normal_adj is just a version of the normal variable where all impacts are averaged out, so, where normal maybe be (1,1,0), normal_adj will be (.5,.5,0) and normal (1.5,.5,0) will be (.75,.25,0), because normal values over 1 may create unpredictable results in some calculations.
I'm also using abs(normal) in all of these spin->vel and vel->spin calculations because it's only the negative normals which are affected, and I'm try to figure out why...
Your signature has been erased by a mod.
Assuming that it really was erased by a mod, and not dapaintballer:
Thanks! (I'm sure dapaintballer changed it to something about gay port again...)