I really want to join in
but I dont know if I'm good enough...
but anyways, if you need any help, i'm normally doing nothing
Yours
N3wton
EDIT
sync on
sync rate 60
autocam off
Hide Mouse
position camera 0.0, 100.0, 0.0
MakeRoom()
Player = MakePlayer()
shadow = Find Free Object()
Load Object "mediashadow.3DS", shadow
Scale Object shadow, 80, 100, 80
Dump = MouseMoveX()
do
Set Camera To Follow Object Position X(Player), Object Position Y(Player), Object Position Z(Player), Object Angle Y(Player), 150, 40, 10, 0
Move$ = movePlayer( Player, 20.0, -0.1, 0.99, Move$ )
Position Object man, Object Position X(Player), Object Position Y(Player), Object Position Z(Player)
Yrotate Object Man, Object Angle Y(Player)
ox = Object Position X(Player) : oy = Object Position Y(Player) : oz = Object Position Z(Player)
floor# = Sc_RayCast( 0, ox, oy, oz, ox, oy-200, oz, Man )
x = SC_getStaticCollisionX()
y = SC_getStaticCollisionY()
z = SC_getStaticCollisionZ()
Position Object shadow, x, y, z
Move Object Up shadow, 0.01
alpha = clamp( 100 - Get Distance(ox, oy, oz, x, y, z, 1), 0, 80 )
Set Alpha Mapping On shadow, alpha/1.5
sync
loop
end
Function MakePlayer()
obj = Find Free Object()
Make Object Sphere obj, 40
Scale Object obj, 100, 200, 100
Sc_SetupObject obj, 0, 1
Offset Limb obj, 0, 0, 10, 0
Sc_AllowObjectScaling obj
Sc_UpdateObject obj
Hide Object obj
global man
man = Find Free Object()
Load Object "mediaSAS.x", man
dump = find free image()
Load Image "mediaSASASSAULT.dds", dump
Texture Object man, dump
Rotate Limb man, 0, 0, 180, 0
offset limb man, 0, 0, -20, 0
Set Object Speed man, 40
endFunction obj
Function MakeRoom()
obj = Find Free Object()
load effect "mediaLightMap.fx", 1, 0
load object "mediaroom.dbo", obj, 3
set object effect obj, 1
Sc_SetupComplexObject obj, 1, 2
endFunction
function movePlayer(player, radius#, gravity#, slope#, Stringdata$)
`==================================
result = instr(Stringdata$ , ",")
vy# = val(left$(Stringdata$, result-1))
Stringdata$ = right$(Stringdata$, len(Stringdata$)-result)
result = instr(Stringdata$ , ",")
ground = val(left$(Stringdata$, result-1))
Stringdata$ = right$(Stringdata$, len(Stringdata$)-result)
jumptimer = val(Stringdata$)
`==================================
yrotate object player, object angle y(player)+mousemovex()/3.0
oldx# = object position x(player)
oldy# = object position y(player)
oldz# = object position z(player)
`==================================
topy# = oldy# + radius#*2.0
`==================================
angy# = object angle y(player)
vx# = 0
vz# = 0
direction = 0
key = 0
if vy#=0 and jumptimer=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
if keystate(17)=1 and key=0 then vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#) : direction = 1 : key = 1
if keystate(31)=1 and key=0 then vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#) : direction = 2 : key = 1
if keystate(30)=1 and key=0 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#) : direction = 3 : key = 1
if keystate(32)=1 and key=0 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#) : direction = 4 : key = 1
select direction
Case 0 : set object speed man, 40 : Loop Object man, 210, 234 : endCase
Case 1 : set object speed man, 40 : Loop Object man, 235, 259 : endCase
Case 2 : set object speed man, -40 : Loop Object man, 235, 259 : endCase
Case 3 : set object speed man, 40 : Loop Object man, 260, 279 : endCase
Case 4 : set object speed man, 40 : Loop Object man, 280, 299 : endCase
endSelect
if ground=1
if spacekey()=1 and jumptimer=0 then vy# = vy# + 4.5 : jumptimer = 20
endif
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
`==================================
if vy# > 0
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,topy#+vy#,oldz#,radius#,0)
else
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
endIf
`==================================
if collide>0
ny# = sc_getCollisionNormalY()
if abs(ny#)>slope#
topy# = sc_getStaticCollisionY()
else
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
endif
if ny#>slope#
ground = 1
vy# = 0
else
ground = 0
if ny#<-slope# then vy# = gravity#
endif
else
oldy# = oldy# + vy#
ground = 0
endif
if ground = 1 and jumptimer>0 then dec jumptimer
`==================================
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#+radius#*2.0,z#,radius#,0)
if collide>0
x# = sc_getCollisionSlideX()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
endif
`==================================
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
if collide>0
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
endif
position object player,x#,oldy#,z#
sc_updateObject player
`==================================
Stringdata$ = str$(vy#) + "," + Str$(ground) + "," + Str$(jumptimer)
`==================================
endfunction Stringdata$
MAIN MOVEMENT CODE
function movePlayer(player, radius#, gravity#, slope#, Stringdata$)
`==================================
result = instr(Stringdata$ , ",")
vy# = val(left$(Stringdata$, result-1))
Stringdata$ = right$(Stringdata$, len(Stringdata$)-result)
result = instr(Stringdata$ , ",")
ground = val(left$(Stringdata$, result-1))
Stringdata$ = right$(Stringdata$, len(Stringdata$)-result)
jumptimer = val(Stringdata$)
`==================================
yrotate object player, object angle y(player)+mousemovex()/3.0
oldx# = object position x(player)
oldy# = object position y(player)
oldz# = object position z(player)
`==================================
topy# = oldy# + radius#*2.0
`==================================
angy# = object angle y(player)
vx# = 0
vz# = 0
direction = 0
key = 0
if vy#=0 and jumptimer=0 then vy# = vy# + 10*gravity# else vy# = vy# + gravity#
if keystate(17)=1 and key=0 then vx# = vx# + sin(angy#) : vz# = vz# + cos(angy#) : direction = 1 : key = 1
if keystate(31)=1 and key=0 then vx# = vx# - sin(angy#) : vz# = vz# - cos(angy#) : direction = 2 : key = 1
if keystate(30)=1 and key=0 then vx# = vx# - cos(angy#) : vz# = vz# + sin(angy#) : direction = 3 : key = 1
if keystate(32)=1 and key=0 then vx# = vx# + cos(angy#) : vz# = vz# - sin(angy#) : direction = 4 : key = 1
select direction
Case 0 : set object speed man, 40 : Loop Object man, 210, 234 : endCase
Case 1 : set object speed man, 40 : Loop Object man, 235, 259 : endCase
Case 2 : set object speed man, -40 : Loop Object man, 235, 259 : endCase
Case 3 : set object speed man, 40 : Loop Object man, 260, 279 : endCase
Case 4 : set object speed man, 40 : Loop Object man, 280, 299 : endCase
endSelect
if ground=1
if spacekey()=1 and jumptimer=0 then vy# = vy# + 4.5 : jumptimer = 20
endif
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
`==================================
if vy# > 0
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,topy#+vy#,oldz#,radius#,0)
else
collide = sc_SphereCastGroup(1,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
endIf
`==================================
if collide>0
ny# = sc_getCollisionNormalY()
if abs(ny#)>slope#
topy# = sc_getStaticCollisionY()
else
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
endif
if ny#>slope#
ground = 1
vy# = 0
else
ground = 0
if ny#<-slope# then vy# = gravity#
endif
else
oldy# = oldy# + vy#
ground = 0
endif
if ground = 1 and jumptimer>0 then dec jumptimer
`==================================
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#+radius#*2.0,z#,radius#,0)
if collide>0
x# = sc_getCollisionSlideX()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
endif
`==================================
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
if collide>0
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
endif
position object player,x#,oldy#,z#
sc_updateObject player
`==================================
Stringdata$ = str$(vy#) + "," + Str$(ground) + "," + Str$(jumptimer)
`==================================
endfunction Stringdata$
thats the full source code to the attached project, needs sparkys and Matrix1 Utility Plug-ins, just an advancement on the current collision code you've got, basically its sphere collisions but it has double the height, so it's like two spheres on top of each other so it has the shape of a human