If I have made a cube and a sphere that are supposed to colide and slide, it will work fine. But if I make the cube taller, the sphere would only collide with the area the former cube used to be. Here is what I have:
Graphics3D 800,600
Const CUBE_COL=1
Const CUBE_COL2=3
Const PLAYER_COL=2
Global speed#,player
Global turn#
SetBuffer BackBuffer()
camera=CreateCamera()
CameraViewport camera,0,0,800,600
PositionEntity camera,0,0,-5
light=CreateLight()
cube=CreateCube()
PositionEntity cube,-8,0,5
ScaleEntity cube,1,9,1
EntityType cube,CUBE_COL
cube2=CreateCube()
PositionEntity cube2,8,0,5
ScaleEntity cube2,1,9,1
EntityType cube2,CUBE_COL2
player=CreateSphere(12)
PositionEntity player,0,-4,5
EntityType player,PLAYER_COL
Collisions PLAYER_COL,CUBE_COL,3,2
Collisions PLAYER_COL,CUBE_COL2,3,2
speed#=0.08
turn#=0
While Not KeyHit(1)
If KeyDown(200) Then
MoveEntity player,speed#,0,0
EndIf
If KeyDown(203) Then
turn#=3
TurnEntity player,0,0,turn#
EndIf
If KeyDown(205) Then
turn#=-3
TurnEntity player,0,0,turn#
EndIf
If EntityCollided(player,CUBE_COL) Then
EndIf
If EntityCollided(player,CUBE_COL2) Then
EndIf
UpdateWorld
RenderWorld
Flip
Wend
End
How do you make the collision recocnise how tall and big the 2 cubes are?
|