Решил для пробы сделать в PureBasic-е библиотеку с командой перемещения объекта в Blitz-е(абсолютно аналогичную TranslateEntity)
Результат какой-то странный:
Global cam
Global plane
Global sph
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
cam = CreateCamera()
plane = CreatePlane()
EntityColor plane,0,100,100
PositionEntity plane,0,-1,0
sph = CreateSphere()
EntityColor sph,150,0,0
PositionEntity sph,0,0,10
dpMoveEntity(sph,0,0,10)
While Not KeyHit(1)
UpdateWorld()
RenderWorld()
Text 400,400,EntityX(sph)
Text 400,450,EntityY(sph)
Text 400,500,EntityZ(sph)
Flip
Wend
End
Вне цикла всё работает правильно.
Global cam
Global plane
Global sph
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
cam = CreateCamera()
plane = CreatePlane()
EntityColor plane,0,100,100
PositionEntity plane,0,-1,0
sph = CreateSphere()
EntityColor sph,150,0,0
PositionEntity sph,0,0,10
While Not KeyHit(1)
dpMoveEntity(sph,0,0,0.1)
UpdateWorld()
RenderWorld()
Text 400,400,EntityX(sph)
Text 400,450,EntityY(sph)
Text 400,500,EntityZ(sph)
Flip
Wend
End
В цикле изменяются лишь параметры объекта, а сам он не двигается.
Global cam
Global plane
Global sph
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
cam = CreateCamera()
plane = CreatePlane()
EntityColor plane,0,100,100
PositionEntity plane,0,-1,0
sph = CreateSphere()
EntityColor sph,150,0,0
dpMoveEntity(sph,0,0,10)
While Not KeyHit(1)
UpdateWorld()
RenderWorld()
Text 400,400,EntityX(sph)
Text 400,450,EntityY(sph)
Text 400,500,EntityZ(sph)
Flip
Wend
End
Если убрать команду PositionEntity, то и вне цикла dpMoveEntity перестаёт работать.
P.S. Вот код из библиотеки:
ProcedureDLL dpMoveEntity(*entity,deltaX.f,deltaY.f,deltaZ.f)
Protected x_pos.f = PeekF(*entity + 64)
Protected y_pos.f = PeekF(*entity + 68)
Protected z_pos.f = PeekF(*entity + 72)
x_pos = x_pos + deltaX
y_pos = y_pos + deltaY
z_pos = z_pos + deltaZ
PokeF(*entity + 64,x_pos)
PokeF(*entity + 68,y_pos)
PokeF(*entity + 72,z_pos)
EndProcedure