Thank you for the reply.
Well, you said there must be a negate of collision to allow X or Z moving. At first I had exactly like you said:
Code:
*Repeat while "W" is pressed
- (OpenGL Camera) Set X Position to: X( "OpenGL Camera" )+Sin(Yaw( "OpenGL Camera" ))
- (OpenGL Camera) Set Z position to: Z( "OpenGL Camera" )+Cos(Yaw( "OpenGL Camera" )+180)
And it works well when there are no walls. :P
I was trying to make a dependence of collision with your helpful post, so I made this that way:
Code:
*Repeat while "W" is pressed
*Alterable Value A of ("Valuer") = 0
- (OpenGL Camera) Set X Position to: X( "OpenGL Camera" )+Sin(Yaw( "OpenGL Camera" ))
*Repeat while "W" is pressed
*Alterable Value B of ("Valuer") = 0
- (OpenGL Camera) Set Z position to: Z( "OpenGL Camera" )+Cos(Yaw( "OpenGL Camera" )+180)
To make a negate collision I used two ifelse object in following events:
Code:
*(OpenGL MS3D) On object loop
*(IfElse1)Start Nested IF 0
*Y("OpenGL Camera") > Y("OpenGL MS3D") - 20
*Y("OpenGL Camera") < Y("OpenGL MS3D") + 20
*X("OpenGL Camera") + Sin(Yaw("OpenGL Camera")) * 2 > X("OpenGL MS3D") - 12
*X("OpenGL Camera") + Sin(Yaw("OpenGL Camera")) * 2 < X("OpenGL MS3D") + 12
*Z("OpenGL Camera") > Z("OpenGL MS3D") - 12
*Z("OpenGL Camera") < Z("OpenGL MS3D") + 12
*(IfElse1)End Nested IF
- ("Valuer") Set Alterable Value A to 1
*(IfElse1)Nested Else 0
- ("Valuer") Set Alterable Value A to 0
*(OpenGL MS3D) On object loop
*(IfElse2)Start Nested IF 0
*Y("OpenGL Camera") > Y("OpenGL MS3D") - 20
*Y("OpenGL Camera") < Y("OpenGL MS3D") + 20
*X("OpenGL Camera") > X("OpenGL MS3D") - 12
*X("OpenGL Camera") < X("OpenGL MS3D") + 12
*Z("OpenGL Camera") + Cos(Yaw("OpenGL Camera")) * 2 > Z("OpenGL MS3D") - 12
*Z("OpenGL Camera") + Cos(Yaw("OpenGL Camera")) * 2 < Z("OpenGL MS3D") + 12
*(IfElse2)End Nested IF
- ("Valuer") Set Alterable Value B to 1
*(IfElse2)Nested Else 0
- ("Valuer") Set Alterable Value B to 0
I hope I haven't made any mistakes while I was rewriting. :P
The following code works only in specific case. It depends of position when going into the cuboid. While I'm trying going to one wall, it works, but when going into different wall it just holds both camera X and Z.
Could you help me and fix the "code" above?
Thanks.