I have just got DP (Fantastic product btw.)
I have one or two little problems that I am trying to figure out.
I have been following the tutorial on character controller to make an FPS camera, here is the code
phy start
autocam off
sync on
sync rate 60
color backdrop 0
position camera 0,20,-70
make light 1
set directional light 1,-5,-5,-5
make object box 1,50,1,50
phy make rigid body static box 1
x#=10
y#=1
for i=10 to 20
make object box i,3,2,10
position object i,x#,y#,0
phy make rigid body static box i
x#=x#+3
y#=y#+1
next i
y#=1
phy make material 1,"tower block"
phy set material dynamic friction 1,1.0
phy set material static friction 1,.95
phy set material restitution 1,0.1
phy build material 1
for i = 21 to 51
make object cube i,2
position object i,-10,y#,0
y#=y#+2
next i
for i=21 to 51
phy make rigid body dynamic box i,1
next i
make object box 2,1,2.5,1
phy make box character controller 2,0,5,0,1,2.5,1,1,1.5,45.0
for i=1 to 51
if object exist(i)
color object i,rgb(rnd(255),rnd(255),rnd(255))
set object specular i,rgb(rnd(255),rnd(255),rnd(255))
set object specular power i,255
set object ambient i,0
endif
next i
hide mouse
do
yrotate object 2,camera angle y()+mousemovex()
xrotate camera camera angle x()+mousemovey()
if camera angle x()<-80 then xrotate camera -80
if camera angle x()>80 then xrotate camera 80
yrotate camera camera angle y()+mousemovex()
position mouse screen width()/2,screen height()/2
if inkey$()="a"
yrotate object 2,object angle y(2)-90
phy move character controller 2,20
yrotate object 2,object angle y(2)+90
endif
if inkey$()="d"
yrotate object 2,object angle y(2)+90
phy move character controller 2,20
yrotate object 2,object angle y(2)-90
endif
phy move character controller 2,0
if inkey$()="w"
phy move character controller 2,20
endif
` else
` phy move character controller 2,0
` endif
if inkey$()="s"
phy move character controller 2,-20
endif
position camera object position x(2),object position y(2),object position z(2)
` rotate camera object angle x(2),object angle y(2),object angle z(2)
yrotate camera object angle y(2)
phy update
sync
loop
I have modified it slightly.
Here are my questions if anybody knows
1. How do I make the character controller jump
2. How am I able to allow the character to move dynamic meshes by walking into them
3. Is there a way to stop the tower collapsing as soon as the program starts?
WE SHALL BECOME ALL POWERFUL! CRUSH THE LESSER RACES! CONQUER THE GALAXY! UNIMAGINABLE POWER! UNLIMITED RICE PUDDING ! ! ! ETC. ! ! ! ETC.! ! !