I have been trying to fix this code but with out much susses. The problem is that the objects vanish and then come back every frame or so. I want the to move to a new location and stay there. he is the code. any help would be gratefully received.
For ode.ODEGeom=Each ODEGeom
RotateEntity ode\mesh,dBodyGetPitch#(ode\geom),dBodyGetYaw#(ode\geom),dBodyGetRoll#(ode\geom)
obx#=dBodyGetPositionX#(ode\body)
oby#=dBodyGetPositionY#(ode\body)
obz#=dBodyGetPositionZ#(ode\body)
ch=0
If obx#>(Local_Player_x#+HalfmapSizeX) Then
obx#=obx# - FullmapSizeX
ch=1
Else If Rx<(Local_Player_x#-HalfmapSizeX) Then
obx#=obx# + FullmapSizeX
ch=1
EndIf
If obz#>(Local_Player_z#+HalfmapSizeY) Then
obz#=obz# - FullmapSizeY
ch=1
Else If obz#<(Local_Player_z#-HalfmapSizeY) Then
obz#=obz# + FullmapSizeY
ch=1
EndIf
dBodyDisable(ode\body)
If ch=1 Then dBodySetPosition(ode\body,obx,oby,obz)
PositionEntity ode\mesh,obx,oby,obz
dBodyEnable(ode\body)
Next
For ode.ODEGeom=Each ODEGeom
RotateEntity ode\mesh,dBodyGetPitch#(ode\geom),dBodyGetYaw#(ode\geom),dBodyGetRoll#(ode\geom)
obx#=dBodyGetPositionX#(ode\body)
oby#=dBodyGetPositionY#(ode\body)
obz#=dBodyGetPositionZ#(ode\body)
ch=0
If obx#>(Local_Player_x#+HalfmapSizeX) Then
obx#=obx# - FullmapSizeX
ch=1
Else If Rx<(Local_Player_x#-HalfmapSizeX) Then
obx#=obx# + FullmapSizeX
ch=1
EndIf
If obz#>(Local_Player_z#+HalfmapSizeY) Then
obz#=obz# - FullmapSizeY
ch=1
Else If obz#<(Local_Player_z#-HalfmapSizeY) Then
obz#=obz# + FullmapSizeY
ch=1
EndIf
dBodyDisable(ode\body)
If ch=1 Then dBodySetPosition(ode\body,obx,oby,obz)
PositionEntity ode\mesh,obx,oby,obz
dBodyEnable(ode\body)
Next