Alright... I am pretty new to this, and i\'ve been having problems with .x collision for long now. I\'m still trying to do things fairly simple. I\'ve tried sparky\'s as far as i can tell... but, it just crashes. So... here we go... when ran my .x collides with my other .x, but, no movement is enabled afterwards. I HAVE actually read almost ALL the collision stuff here, and can\'t figure it out... hence why i\'m new. Another problem is my gravity and jump, i know it can easily be fixed but, i don\'t know how. As long as the space bar is being held you are increasing your height, the gravity seems to be working fine, but it\'s hard to tell cause my .x models will not move, but will rotate... can someone help please... sorry for this being so lengthy, i like to explain everything before going on. I\'m trying to make an RPG in 3rd person, kind of like Morrowind, but maybe make it Online playable. Anyways, heres the whole code, it\'s a little sloppy i think, but, i\'ve been screwing around with it so much, i don\'t even know where i am now.
OH... I have the collision mixed in with the character movement function and the gravity/jump stuff i think
Rem Project: Dreamon Star
Rem Created: 2/22/2007 4:35:59 PM
Rem ***** Main Source File *****
Sync On : Sync Rate 100
Set Camera Range 0.1, 5000
REM Loading Screen
Initial_Loading()
REM Title Screen
Load_World()
REM Character Selection
REM Main Loop
Do
Move_Character()
Update_Camera()
Collision()
Gravity()
Jump()
sync
loop
REM Character Control
Function Move_Character()
x1#=object position x (9999)
z1#=object position y (9999)
y1#=object position z (9999)
ax#=object angle x (9999)
ay#=object angle y (9999)
az#=object angle z (9999)
mx#=mousemovex()
my#=mousemovey()
if mx#<0 then yrotate object 9999,ay#-2
if mx#>0 then yrotate object 9999,ay#+2
REM \"W\"
if keystate(17)=1 then move object 9999,-0.3
REM \"S\"
if keystate(31)=1 then move object 9999,0.3
REM \"A\"
if keystate(32)=1 then move object left 9999,ax#+0.2
REM \"D\"
if keystate(30)=1 then move object right 9999,ax#+0.2
print x1#
print z1#
print y1#
endfunction
Function Collision()
REM Collision
endfunction
REM Camera Control
function Update_Camera()
x1# = object position x(9999)
y1# = object position y(9999)
z1# = object position z(9999)
a1#=object angle y(9999)
d#=-30
h#=50
s#=50
set camera to follow x1#,y1#,z1#,a1#,d#,h#,s#,1
point camera 0,x1#-5,y1#,z1#
endfunction
REM Loading
function Load_World()
REM Main World
Fog Color RGB(28,128,128)
Fog Distance 5
Fog On
load object \"maps/map_example.x\",1
position object 1,0,0,0
set object collision on 1
set object collision to polygons 1
load object \"characters/Opec_Tiesins/Opec_With_Tail.x\",9999
fix object pivot 9999
position object 9999,0,5,5
set object collision on 9999
set object collision to polygons 9999
endfunction
function Initial_Loading()
set text font \"arial\" : set text size 16
set text to bold : set text transparent
sync : center text screen width()/2,screen height()/2, \"LOADING\" : sync
endfunction
function Jump()
Jump#=0
Jumping#=0
Jump_Power#=0
Jump_Speed#=0
Ground#=Object Position y(9999)
If spacekey()=1 and Jumping#=0 then Jump#=1
If Jump#=1
Ground#=Object Position y(9999)
Jump_Speed#=5
Jumping#=1
EndIf
If Jumping#=1
Dec Jump_Speed#,0.001
Position Object 9999,Object Position x(9999), Object Position Y(9999)+Jump_Speed#, Object Position z(9999)
If Object Position Y(9999)<=Ground# Then Jumping#=0
Jump#=0
EndIf
endfunction
function Gravity()
x1# = object position x(9999)
y1# = object position y(9999)
z1# = object position z(9999)
gravity# = -0.98
position object 9999,x1#,y1#+gravity#,z1#
if object collision (9999,1) then position object 9999,x1#,y1#,z1# else
position object 9999,nx#,ny#,nz#
nx# = object position x(9999)
ny# = object position y(9999)
nz# = object position z(9999)
endfunction
Thanks in advance
www.soundclick.com/octoberscry ---> My Doom Metal Band