Hi all, I'm currently working on a game and I've been stuck with this one thing for quite some time now. My game is made out of a 3d map with 4 walls in it (formed in a square) and I have a ball in it. Now what I want is to make the ball bounce of the walls like a real ball would, I've been through the forums and codebase a lot of times but all I found were solutions for 2d ball physics. Mine, however is completely 3d and I have no clue at all how to do this. I so far have some code which does not really do what I want it to do. Does anyone have a good solution to this problem?
`Store current object positions
CurX#=object position x(25)
CurY#=object position y(25)
CurZ#=object position z(25)
`Check for collision
if object collision(25,0) <> 0
`first check for X-ax collision
position object 25, BallPosX#, CurY#, CurZ#
if object collision(25,0)<>0
`Then try Z-ax
Position object 25, CurX#, CurY#, BallPosZ#
If Object Collision(25,0)<>0
`And finally Y-ax
Position Object 25, CurX#, BallPosY#, CurZ#
`No collision so we restore the old positions
If Object Collision(25,0)<>0
aCurX#=Object Angle X(25)
aCurY#=Object Angle Y(25)
aCurZ#=Object Angle Z(25)
Else
`Seems the collision was on the Y-ax
CurY#=Object Angle Y(25)
EndIf
Else
`Collision on Z-ax
aCurZ#=Object Angle Z(25)
EndIf
else
`Collision took place on X-ax
aCurX#=Object Angle X(25)
endif
EndIf
`Apply new positions
position object 25, 360-aCurX#, 360-aCurY#, 360-aCurZ#
To subdue the enemy without fighting is the highest skill...