Page 1 of 1

Move any attached object to a global position

Posted: Tue Feb 18, 2020 10:37 pm
by Psychophanta
Is there a clean way (not workaround) to position an attached object to a given global position?
If yes, please a tip?

NOTICE:
MoveEntity() with flags #PB_Absolute|#PB_World does not work. ( viewtopic.php?f=13&t=74619 )

Re: Move any attached object to a global position

Posted: Wed Feb 19, 2020 3:49 pm
by applePi
Hi Psychophanta
yes it seems we can position an attached object to a given global position.
here is an example i was experimenting : 4 spheres attached to a Cone and we can let every sphere to rotate around the cone using absolute position with MoveEntity using circular motion formula
tested with PB571 winXP
to look to the scene from above Press 'Space' key

Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()

OpenWindow(0, 0, 0, 800, 600, " scene ...  press Space to toggle Camera Position", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)

Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()

CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 3, 15)
CameraLookAt(0, 0,0,0)
CameraBackColor(0, RGB(155,155,155))
GreenMaterial   = GetScriptMaterial(#PB_Any, "Color/Yellow")
RedMaterial   = GetScriptMaterial(#PB_Any, "Color/Green")
CarTexture = LoadTexture(#PB_Any, "RustyBarrel.png")
CarMaterial   = CreateMaterial(#PB_Any, TextureID(CarTexture))
SetMaterialColor(CarMaterial, #PB_Material_SelfIlluminationColor, RGB(0,0,255))
SetMaterialColor(RedMaterial, #PB_Material_SelfIlluminationColor, RGB(200,0,25))
CreateMaterial(1, LoadTexture(1, "Dirt.jpg"))
        
        CreateMaterial(4, LoadTexture(4, "RustyBarrel.png"))
        

;CreateLight(#Light, Color [, x, y, z [, Flags]])
;CreateLight(1, RGB(220,20,120), 0,100,20)
CreateLight(1, RGB(220,220,220), 0,100,20)
;CreateLight(2, RGB(220,220,220), -100,100,-10)

ConeMesh = CreateCone(#PB_Any, 0.6, 1, 6, 8)
SphereMesh = CreateSphere(#PB_Any,0.5)
carMesh = LoadMesh(#PB_Any, "chassis.mesh")
SetMeshMaterial(ConeMesh, MaterialID(RedMaterial))

Cone = CreateEntity(#PB_Any, MeshID(ConeMesh), #PB_Material_None, 0, 0, 0)

Sphere1 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), -5, 0, 0)
Sphere2 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 5, 0, 0)
sphere3 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 0, 0, 5)
sphere4 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 0, 0, -5)
Car     = CreateEntity(#PB_Any, MeshID(CarMesh),    MaterialID(CarMaterial), 0, 1, 0)
ScaleEntity(car, 0.4,0.4,0.4)

AttachEntityObject(Cone, "", EntityID(sphere1));, 10, -8, -5, 0, 0, 0)
AttachEntityObject(Cone, "", EntityID(sphere2))
AttachEntityObject(Cone, "", EntityID(sphere3))
AttachEntityObject(Cone, "", EntityID(sphere4))
AttachEntityObject(Cone, "", EntityID(Car))
;create ground entity using the Cone mesh number 0 created above 
ground = CreateEntity(#PB_Any, MeshID(ConeMesh), #PB_Material_None, 0, -2, 0)
; and then we scale it to resemble a ground
ScaleEntity(ground, 12,0.5,12)

CreateCapsule(5, 0.2,1)
CreateEntity(5, MeshID(5), MaterialID(4), -3,-1,0)
CreateSphere(6, 1)
CreateEntity(6, MeshID(6), MaterialID(1), -3,-0.3,0)
ScaleEntity(6,1,0.1,1)

OrbitRadius.f = 5
angle1.f = 0
angle2.f = 2*#PI/4
angle3.f = 2*#PI/2
angle4.f = 2*#PI*3/4 
flag = 1
Repeat
    Repeat
    event = WindowEvent()
  Until event = 0
  
  ExamineKeyboard()
      
  If KeyboardReleased(#PB_Key_Space)
    If flag
    MoveCamera(0, 0, 25, 0.001, #PB_Absolute)
    CameraLookAt(0, 0,0,0)
    flag ! 1
  Else
    MoveCamera(0, 0, 3, 15, #PB_Absolute)
    CameraLookAt(0, 0,0,0)
    flag ! 1
        
  EndIf
  
EndIf

    
  angle1.f + 0.02
  angle2.f + 0.02
  angle3.f + 0.02
  angle4.f + 0.02
  
  x1.f=Cos(angle1)*OrbitRadius
  z1.f=Sin(angle1)*OrbitRadius
  
  x2.f=Cos(angle2)*OrbitRadius
  z2.f=Sin(angle2)*OrbitRadius
  
  x3.f=Cos(angle3)*OrbitRadius
  z3.f=Sin(angle3)*OrbitRadius
  
  x4.f=Cos(angle4)*OrbitRadius
  z4.f=Sin(angle4)*OrbitRadius
  
  MoveEntity(sphere1, x1,2,z1, #PB_Absolute)
  MoveEntity(sphere2, x2,2, z2, #PB_Absolute)
  MoveEntity(sphere3, x3,2, z3, #PB_Absolute)
  MoveEntity(sphere4, x4,2, z4, #PB_Absolute)
  ;RotateEntity(Cone, 0,1,0, #PB_Relative) ; rotate the parent
  
  RenderWorld()
  
  FlipBuffers()
  
  ExamineKeyboard()
  
Until KeyboardPushed(#PB_Key_Escape)
also we can rotate all the this complex "solar system" by using MoveEntity with the Cone using circular motion formula. and all the system including the planets is shifted with the Cone while it is rotating around it with moveEntity with #PB_Absolute.
i haven't used other than #PB_Absolute with MoveEntity
(the tree and the car is just for fun)

Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()

OpenWindow(0, 0, 0, 800, 600, " scene ...  press Space to toggle Camera Position", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)

Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()

CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 5, 25)
CameraLookAt(0, 0,0,0)
CameraBackColor(0, RGB(155,155,155))
GreenMaterial   = GetScriptMaterial(#PB_Any, "Color/Yellow")
RedMaterial   = GetScriptMaterial(#PB_Any, "Color/Green")
CarTexture = LoadTexture(#PB_Any, "RustyBarrel.png")
CarMaterial   = CreateMaterial(#PB_Any, TextureID(CarTexture))
SetMaterialColor(CarMaterial, #PB_Material_SelfIlluminationColor, RGB(0,0,255))
SetMaterialColor(RedMaterial, #PB_Material_SelfIlluminationColor, RGB(200,0,25))
CreateMaterial(1, LoadTexture(1, "Dirt.jpg"))
        
        CreateMaterial(4, LoadTexture(4, "RustyBarrel.png"))
        

;CreateLight(#Light, Color [, x, y, z [, Flags]])
;CreateLight(1, RGB(220,20,120), 0,100,20)
CreateLight(1, RGB(220,220,220), 0,100,20)
;CreateLight(2, RGB(220,220,220), -100,100,-10)

ConeMesh = CreateCone(#PB_Any, 0.6, 1, 6, 8)
SphereMesh = CreateSphere(#PB_Any,0.5)
carMesh = LoadMesh(#PB_Any, "chassis.mesh")
SetMeshMaterial(ConeMesh, MaterialID(RedMaterial))

Cone = CreateEntity(#PB_Any, MeshID(ConeMesh), #PB_Material_None, 0, 0, 0)

Sphere1 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), -5, 0, 0)
Sphere2 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 5, 0, 0)
sphere3 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 0, 0, 5)
sphere4 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 0, 0, -5)
Car     = CreateEntity(#PB_Any, MeshID(CarMesh),    MaterialID(CarMaterial), 0, 1, 0)
ScaleEntity(car, 0.4,0.4,0.4)

AttachEntityObject(Cone, "", EntityID(sphere1));, 10, -8, -5, 0, 0, 0)
AttachEntityObject(Cone, "", EntityID(sphere2))
AttachEntityObject(Cone, "", EntityID(sphere3))
AttachEntityObject(Cone, "", EntityID(sphere4))
AttachEntityObject(Cone, "", EntityID(Car))
;create ground entity using the Cone mesh number 0 created above 
ground = CreateEntity(#PB_Any, MeshID(ConeMesh), #PB_Material_None, 0, -2, 0)
; and then we scale it to resemble a ground
ScaleEntity(ground, 12,0.5,12)

CreateCapsule(5, 0.2,1)
CreateEntity(5, MeshID(5), MaterialID(4), -3,-1,0)
CreateSphere(6, 1)
CreateEntity(6, MeshID(6), MaterialID(1), -3,-0.3,0)
ScaleEntity(6,1,0.1,1)

OrbitRadius.f = 3
angle1.f = 0
angle2.f = 2*#PI/4
angle3.f = 2*#PI/2
angle4.f = 2*#PI*3/4 

angle0.f = 0

flag = 1
Repeat
    Repeat
    event = WindowEvent()
  Until event = 0
  
  ExamineKeyboard()
      
  If KeyboardReleased(#PB_Key_Space)
    If flag
    MoveCamera(0, 0, 30, 0.0001, #PB_Absolute)
    CameraLookAt(0, 0,0,0)
    flag ! 1
  Else
    MoveCamera(0, 0, 5, 25, #PB_Absolute)
    CameraLookAt(0, 0,0,0)
    flag ! 1
        
  EndIf
  
EndIf

    
  angle1.f - 0.05
  angle2.f - 0.05
  angle3.f - 0.05
  angle4.f - 0.05
  
  x1.f=Cos(angle1)*OrbitRadius
  z1.f=Sin(angle1)*OrbitRadius
  
  x2.f=Cos(angle2)*OrbitRadius
  z2.f=Sin(angle2)*OrbitRadius
  
  x3.f=Cos(angle3)*OrbitRadius
  z3.f=Sin(angle3)*OrbitRadius
  
  x4.f=Cos(angle4)*OrbitRadius
  z4.f=Sin(angle4)*OrbitRadius
  
  MoveEntity(sphere1, x1,2,z1, #PB_Absolute )
  MoveEntity(sphere2, x2,2, z2, #PB_Absolute  )
  MoveEntity(sphere3, x3,2, z3, #PB_Absolute  )
  MoveEntity(sphere4, x4,2, z4, #PB_Absolute  )
  ;RotateEntity(Cone, 0,1,0, #PB_Relative) ; rotate the parent
  
  angle0.f + 0.01
  
  x0.f=Cos(angle0)*OrbitRadius*3
  z0.f=Sin(angle0)*OrbitRadius*3
  MoveEntity(Cone, x0,2, z0, #PB_Absolute)
  
  RenderWorld()
  
  FlipBuffers()
  
  ExamineKeyboard()
  
Until KeyboardPushed(#PB_Key_Escape)

Re: Move any attached object to a global position

Posted: Wed Feb 19, 2020 6:04 pm
by IdeasVacuum
Great stuff applePi. I have always envisaged that you like like Merlin :D

Re: Move any attached object to a global position

Posted: Thu Feb 20, 2020 4:20 pm
by Psychophanta
Hi, dear applePi.

Sorry to say that your answer, as i see, has no thing to do with the bug (as i understand it) i pointed to.
So, please, re-read my post.

And please play with some tips to realize these facts i have catched, about the MoveEntity() function:
1. Flag '#PB_Absolute' is referred to the (0,0,0) global coordinates when not attached, and referred to coordinates of the parent when it is attached.
2. Flags '#PB_Absolute|#PB_World', '#PB_Absolute|#PB_Local', '#PB_Absolute|#PB_Parent', '#PB_Relative|#PB_World', ''#PB_Relative|#PB_Local', '#PB_Relative|#PB_Parent' , all of them 6 , have JUST the SAME effect, in the attached case, and in the not attached case. BEWARE: All of them move the piece RELATIVE to its current position, i.e. all of them are just like use '#PB_Relative' flag.

So, no way to do a clean (not workaround) positionating an object to a global coordinates when it is attached, at least in my observations.

In conclusion of all it:
The MoveEntity() function seems to be an unfinished one, as it only accepts two behaviours, depending on its flag is zero ('#PB_Absolute') or not zero (any other):
1) '#PB_Absolute', which moves the object to the given coordinates, which are relative to (0,0,0) if not attached, and relative to (x,y,z) coordinates of the parent when the object is attached to it.
2) Any other flag, including '#PB_Relative', give all of them JUST THE SAME RESULT: move the object to the given coordinates, which are relative to current position of the object RESPECT to the global (0,0,0), DISREGARDING it is attached or not.

Re: Move any attached object to a global position

Posted: Fri Feb 21, 2020 8:24 am
by applePi
Psychophanta, I know from long time ago that #PB_World, #PB_Local, #PB_Parent is useless, this is why i use always #PB_Absolute, #PB_Relative only.
nothing better than a solar system to demonstrate these things. in my second example above the planets is attached to the cone and they rotate around it with MoveEntity using #PB_Absolute. and then we do MoveEntity the Cone using #PB_Absolute in a Big orbit, and it works, a solar system .
but we can say how it works the absolute of the absolute: #PB_Absolute of the cone X (#PB_Absolute of the planets) ! i realize the dilemma, surely a matrix mathematics is playing behind the scene here.
here is even more complex i have added a cube. and the cone is attached to the cube, the spheres is attached to the cone. when we rotate the cube with moveEntity (#PB_Absolute) now the cone (and its planets) is rotating around the cube... .
but i can't rotate the cube (the big Master) around itself without affecting all the system . in this case i have to attach a fake CubeWife to the Cube in the cube position, and then rotate the CubeWife while hiding the Cube with HideEntity(). the CubeWife should be at the same position as the Cube by the pure action of attachment or moveEntity (CubeWife,0,0,0, #PB_Absolute), it does not work to move it Globally since it stay at a fixed distance from the cube (here i see a Bug crawling from the complexity, and we need a working #PB_World, #PB_Local, #PB_Parent)

Code: Select all

InitEngine3D()
InitSprite()
InitKeyboard()

OpenWindow(0, 0, 0, 800, 600, " scene ...  press Space to toggle Camera Position", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600)

Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Scripts", #PB_3DArchive_FileSystem)
Parse3DScripts()

CreateCamera(0, 0, 0, 100, 100)
;MoveCamera(0, 0, 5, 25)
MoveCamera(0, 0, 45, 0.0001, #PB_Absolute)
CameraLookAt(0, 0,0,0)
CameraBackColor(0, RGB(155,155,155))
GreenMaterial   = GetScriptMaterial(#PB_Any, "Color/Yellow")
RedMaterial   = GetScriptMaterial(#PB_Any, "Color/Green")
CarTexture = LoadTexture(#PB_Any, "RustyBarrel.png")
CarMaterial   = CreateMaterial(#PB_Any, TextureID(CarTexture))
SetMaterialColor(CarMaterial, #PB_Material_SelfIlluminationColor, RGB(0,0,255))
SetMaterialColor(RedMaterial, #PB_Material_SelfIlluminationColor, RGB(200,0,25))
CreateMaterial(1, LoadTexture(1, "Dirt.jpg"))
        
        CreateMaterial(4, LoadTexture(4, "RustyBarrel.png"))
        

;CreateLight(#Light, Color [, x, y, z [, Flags]])
;CreateLight(1, RGB(220,20,120), 0,100,20)
CreateLight(1, RGB(220,220,220), 0,100,20)
;CreateLight(2, RGB(220,220,220), -100,100,-10)

ConeMesh = CreateCone(#PB_Any, 0.6, 1, 16, 8)
SphereMesh = CreateSphere(#PB_Any,0.5)
carMesh = LoadMesh(#PB_Any, "chassis.mesh")
CubeMesh = CreateCube(#PB_Any, 1)
SetMeshMaterial(ConeMesh, MaterialID(RedMaterial))
SetMeshMaterial(CubeMesh, MaterialID(RedMaterial))

Cone = CreateEntity(#PB_Any, MeshID(ConeMesh), #PB_Material_None, 0, 0, 0)
Cube = CreateEntity(#PB_Any, MeshID(CubeMesh), #PB_Material_None, 0, 0, 0)
CubeWife = CreateEntity(#PB_Any, MeshID(CubeMesh), #PB_Material_None, 0, 0, 0)

Sphere1 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), -5, 0, 0)
Sphere2 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 5, 0, 0)
sphere3 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 0, 0, 5)
sphere4 = CreateEntity(#PB_Any, MeshID(SphereMesh), MaterialID(GreenMaterial), 0, 0, -5)
Car     = CreateEntity(#PB_Any, MeshID(CarMesh),    MaterialID(CarMaterial), 0, 1, 0)
ScaleEntity(car, 0.4,0.4,0.4)

AttachEntityObject(Cone, "", EntityID(sphere1));, 10, -8, -5, 0, 0, 0)
AttachEntityObject(Cone, "", EntityID(sphere2))
AttachEntityObject(Cone, "", EntityID(sphere3))
AttachEntityObject(Cone, "", EntityID(sphere4))
AttachEntityObject(Cone, "", EntityID(Car))
AttachEntityObject(Cube, "", EntityID(Cone))
AttachEntityObject(Cube, "", EntityID(CubeWife))


;create ground entity using the Cone mesh number 0 created above 
ground = CreateEntity(#PB_Any, MeshID(ConeMesh), #PB_Material_None, 0, -2, 0)
; and then we scale it to resemble a ground
ScaleEntity(ground, 12,0.5,12)

CreateCapsule(5, 0.2,1)
CreateEntity(5, MeshID(5), MaterialID(4), -3,-1,0)
CreateSphere(6, 1)
CreateEntity(6, MeshID(6), MaterialID(1), -3,-0.3,0)
ScaleEntity(6,1,0.1,1)

OrbitRadius.f = 2.5
angle1.f = 0
angle2.f = 2*#PI/4
angle3.f = 2*#PI/2
angle4.f = 2*#PI*3/4 

angle0.f = 0

flag = 1
Repeat
    Repeat
    event = WindowEvent()
  Until event = 0
  
  ExamineKeyboard()
      
  If KeyboardReleased(#PB_Key_Space)
    If flag
      ;MoveCamera(0, 0, 45, 0.0001, #PB_Absolute)
      MoveCamera(0, 0, 10, 35, #PB_Absolute)
    CameraLookAt(0, 0,0,0)
    flag ! 1
  Else
    ;MoveCamera(0, 0, 5, 35, #PB_Absolute)
    MoveCamera(0, 0, 45, 0.0001, #PB_Absolute)
    CameraLookAt(0, 0,0,0)
    flag ! 1
        
  EndIf
  
EndIf

    
  angle1.f - 0.05
  angle2.f - 0.05
  angle3.f - 0.05
  angle4.f - 0.05
    
  x1.f=Cos(angle1)*OrbitRadius
  z1.f=Sin(angle1)*OrbitRadius
  
  x2.f=Cos(angle2)*OrbitRadius
  z2.f=Sin(angle2)*OrbitRadius
  
  x3.f=Cos(angle3)*OrbitRadius
  z3.f=Sin(angle3)*OrbitRadius
  
  x4.f=Cos(angle4)*OrbitRadius
  z4.f=Sin(angle4)*OrbitRadius
  
    
  MoveEntity(sphere1, x1,2,z1, #PB_Absolute )
  MoveEntity(sphere2, x2,2, z2, #PB_Absolute  )
  MoveEntity(sphere3, x3,2, z3, #PB_Absolute  )
  MoveEntity(sphere4, x4,2, z4, #PB_Absolute  )
  ;RotateEntity(Cone, 0,1,0, #PB_Relative) ; rotate the parent
  
  angle0.f + 0.01
  
  x0.f=Cos(angle0)*OrbitRadius*2
  z0.f=Sin(angle0)*OrbitRadius*2
  MoveEntity(Cone, x0,2, z0, #PB_Absolute)
    
  angle5.f + 0.002
  x5.f=Cos(angle5)*OrbitRadius * 4
  z5.f=Sin(angle5)*OrbitRadius * 4
  MoveEntity(Cube, x5,2, z5, #PB_Absolute)
  ;MoveEntity(CubeWife, x5,2, z5, #PB_Absolute) ;does Not work
  ;MoveEntity(CubeWife, 0,2, 0, #PB_Absolute) ; works okay
  RotateEntity(CubeWife, 0,5,0, #PB_Relative) 
    
  HideEntity(Cube, 1) ; to prevent the flicker
  RenderWorld()
  
  FlipBuffers()
  
  ExamineKeyboard()
  
Until KeyboardPushed(#PB_Key_Escape)

Re: Move any attached object to a global position

Posted: Fri Feb 21, 2020 2:47 pm
by Psychophanta
So, again, in your tip, when you use MoveEntity(), you are not positionating sphere1, sphere2, Cone, Car, etc. relative to the global world base (0,0,0), but to their corresponding parent item. Even you use '#PB_Absolute' flag. :wink:

Re: Move any attached object to a global position

Posted: Fri Feb 21, 2020 8:55 pm
by DK_PETER
As stated I don't think (not sure) that what we're seeing is a bug. If I want a fixed position, I don't use the flags anyway.
ApplePi may be right, though, that the original purpose with the flags are somewhat - redundant in its present
form? At least when using the flags combined with #PB_Absolute.
The team should take a look at the flags and perhaps give a more detailed description of their usage.
Since the doc specify something related to 'move'...
It doesn't make sense using it with #PB_Absolute. (imho)

Re: Move any attached object to a global position

Posted: Fri Feb 21, 2020 10:10 pm
by Demivec
I think there may be an issue with the flags values.

#PB_Absolute = 0
#PB_Relative = 1

The other flags #PB_Local, #PB_Parent and #PB_World have the values of 2, 4 and 8. You are supposed to be able to combine them.

#PB_Relative is designated as the default. Assuming that the parameter is interpreted as 'Mode | #PB_Relative' this means it will always overide #PB_Absolute because you can never detect if a zero value has been combined into the value for the Mode parameter.


@Edit: Correction made to constant values. I changed them from their binary values to their decimal values.

Re: Move any attached object to a global position

Posted: Sat Feb 22, 2020 1:42 am
by IdeasVacuum
@ DK_Peter -

Flags could mean:

#PB_Absolute - move in absolute World Ordinates
#PB_Relative - move relative to Local Coordinates of a region or Object

I'm not saying that's what they do mean in PB (See ApplePi's notes), only that "Absolute" can have a place in the context of "move". It's commonplace in Cad-Cam.

@ Demivec there could be an issue with the #PB_Absolute value but ApplePi's logic makes sense - #PB_Absolute and #PB_Relative are either-or options, not to be combined with any others.

Would be great if the Help could be updated with diagrams. A picture paints a thousand words and the Help in my view just doesn't have enough of them :)

Re: Move any attached object to a global position

Posted: Sat Feb 22, 2020 4:35 am
by Demivec
IdeasVacuum wrote:@ Demivec there could be an issue with the #PB_Absolute value but ApplePi's logic makes sense - #PB_Absolute and #PB_Relative are either-or options, not to be combined with any others.

Would be great if the Help could be updated with diagrams. A picture paints a thousand words and the Help in my view just doesn't have enough of them :)
Well about the flags being either/or options, the help says it's a pairing of one of the first two with one of the second three.

Code: Select all

The move mode. It can be one of the following values: 
  #PB_Relative: relative move, from the current entity position (default).
  #PB_Absolute: absolute move to the specified position.

combined with one of the following values: 
  #PB_Local : local move.
  #PB_Parent: move relative to the parent position.
  #PB_World : move relative to the world.

On the second point about diagrams and such I whole heartedly agree.

Re: Move any attached object to a global position

Posted: Sat Feb 22, 2020 9:23 am
by Psychophanta
That's it.
You can consider it as a bug or not.
But, if you read the manual, as Demivec pointed, you will see there is an inconsistence with the facts experienced.
So, if for you it is not a bug, ok, but you must realize the manual is wrong then.

Re: Move any attached object to a global position

Posted: Sat Feb 22, 2020 11:37 am
by DK_PETER
Psychophanta wrote:That's it.
You can consider it as a bug or not.
But, if you read the manual, as Demivec pointed, you will see there is an inconsistence with the facts experienced.
So, if for you it is not a bug, ok, but you must realize the manual is wrong then.
I agree completely. There is absolutely inconsistencies and these should be fixed. The manual should be better at explaining
how these flags are used.
The lack of information (or misinformation) makes it difficult to effectively define it as a bug. (Even though it looks like one).
As ApplePi stated:
I know from long time ago that #PB_World, #PB_Local, #PB_Parent is useless, this is why i use always #PB_Absolute, #PB_Relative only.
I also took that road a long time ago. It never really did what I wanted to or expected. :wink:

@IdeasVacuum
#PB_Absolute - move in absolute World Ordinates
#PB_Relative - move relative to Local Coordinates of a region or Object
Absolutely...They could. Further information is a must.

Re: Move any attached object to a global position

Posted: Sun Feb 23, 2020 10:13 am
by Demivec
Here is a link to a post at the time the constants were modified for MoveEntity() for PB v5.00 in 2012.

Comtois would seem to be the one that might be able to shed some light on things.