I have created a world using .x models. I am using polygon collision which works fine. But as soon as I rotate the object the collision fails.
Is this a bug, or is there something that I have to do to the object after rotating so that polygon collision works correctly?
My collision and camera controll is included incase that is at fault.
rem -------------------------------------------------------------------------------
rem Camera and pointer control
If Leftkey() then Yrotate Object 2, Wrapvalue(Object Angle Y(2) - 5): CharMoved# = 1
If Rightkey() then Yrotate Object 2, Wrapvalue(Object Angle Y(2) + 5): CharMoved# = 1
If Upkey() then move object 2, 2.5: CharMoved# = 1
If Downkey() Then Move Object 2, - 2.5: CharMoved# = 1
Rem If Char has moved then check for collisions
If CharMoved# = 1
Position Object 1, 0, -50, 0
CharMoved# = 0
CamMoved# = 1
CamMoved2# = 1
Print "Char Collision Processing"
If Object Collision(2,0) = 0 and Object Position Y(2) > 5
CharMoved# = 1
For I = 1 to 3
Move object down 2, 1
If Object Collision(2,0) > 0 Then Move Object Up 2, 1: CharMoved# = 0: Exit
Next I
Endif
If Object Collision(2, 0) > 0
CharMoved# = 1
For I = 1 to 4
If Object Collision(2,0) > 0 Then Move object up 2, 1
Next I
If Object Collision(2, 0) > 0 Then Position Object 2, CharX#, CharY#, CharZ#
Endif
Endif
Rem Cam Collision detection
If CamMoved# = 1
Print "Cam Collision Processing " + Str$(CamMoved2#)
Position Object 1, Camera Position X(), Camera Position Y(), Camera Position Z()
If Object Collision (1, 0) > 0 And CamDist# > 0 And CamMoved2# = 1 And Object Collision (1, 2) = 0 Then CamMoved2# = 2
If Object Collision (1, 0) = 0 And CamDist# 0 And Object Collision (1, 2) = 0
CamAdvance:
CamX# = Newxvalue(CamX#, Camera Angle Y(), 5)
CamZ# = Newzvalue(CamZ#, Camera Angle Y(), 5)
Position Object 1, CamX#, Camera Position Y(), CamZ#
If Object Collision (1, 0) > 0 Then Goto CamAdvance
CamMoved2# = 2
Endif
If Camera Position X() = CamX# And Camera Position Y() = CamY# And Camera Position Z() = CamZ# Then CamMoved# = 0
rem Save Old values
CharX# = Object position X(2)
CharY# = Object Position Y(2)
CharZ# = Object Position Z(2)
CamX# = Camera Position X()
CamY# = Camera Position Y()
CamZ# = Camera Position Z()
EndIf
rem -------------------------------------------------------------------------------
Thanks in advance
MoonPhoenix