hello, after searching in forum and didn't find why my game's crashes, i accidently found what makes my game crashes
here is code when still crashes
Sync ON
Sync Rate 100
AutoCam Off
Phy Start
global naren as boolean = 0
Load Object "terrain.x",100001
SC_SetupComplexObject 100001,0,2
Phy Make Rigid Body Static Mesh 100001
Make Object Box 2,16,32,16
Position Object 2,5000,256,-5000
SC_SetupObject 2,0,2
SC_AllowObjectScaling 2
Do
If SC_ObjectCollision(2,100001)=0
Position Object 2,Object Position X(2),Object Position Y(2)-0.5,Object Position Z(2)
Else
Position Object 2,Object Position X(2),Object Position Y(2),Object Position Z(2)
Endif
YRotate Object 2,Object Angle Y(2)+MouseMoveX()
If MouseClick()=1 then Move Object 2,0.5
If MouseClick()=2 then Move Object 2,-0.5
IF SpaceKey()
If naren = 0 then Phy Make Rigid Body Dynamic Box 2,1 : naren = 1
Phy Add Rigid Body Force 2,0,0,100,5
Endif
Position Camera Object Position X (2), Object Position Y(2)+16, Object Position Z(2)
Rotate Camera Camera Angle X()+MouseMoveY(), Object Angle Y(2),Object Angle Z(2)
Move Camera -32
Text 0,0,str$(Object Position X(2))
Text 0,20,str$(Object Position Y(2))
Text 0,40,str$(Object Position Z(2))
Text 0,60,str$(naren)
SC_UpdateObject 2
Phy Update
Sync
Loop
Phy End
here is code that not crashes
Load Object "terrain.x",50001
SC_SetupComplexObject 50001,0,2
Phy Make Rigid Body Static Mesh 50001
Make Object Box 2,16,32,16
Position Object 2,5000,256,-5000
SC_SetupObject 2,0,2
SC_AllowObjectScaling 2
Do
If SC_ObjectCollision(2,50001)=0
Position Object 2,Object Position X(2),Object Position Y(2)-0.5,Object Position Z(2)
Else
Position Object 2,Object Position X(2),Object Position Y(2),Object Position Z(2)
Endif
YRotate Object 2,Object Angle Y(2)+MouseMoveX()
If MouseClick()=1 then Move Object 2,0.5
If MouseClick()=2 then Move Object 2,-0.5
IF SpaceKey()
If naren = 0 then Phy Make Rigid Body Dynamic Box 2,1 : naren = 1
Phy Add Rigid Body Force 2,0,0,100,5
Endif
Position Camera Object Position X (2), Object Position Y(2)+16, Object Position Z(2)
Rotate Camera Camera Angle X()+MouseMoveY(), Object Angle Y(2),Object Angle Z(2)
Move Camera -32
Text 0,0,str$(Object Position X(2))
Text 0,20,str$(Object Position Y(2))
Text 0,40,str$(Object Position Z(2))
Text 0,60,str$(naren)
SC_UpdateObject 2
Phy Update
Sync
Loop
Phy End
(ignore that weird variable name and that weird gravity algorithm, it just for test lol)
why when i change objectID of terrain.x into 50001 it not crashes? :/
sorry for my english hehe
AI Game Studio