Question: is there possible to make a 100% rigid joint?

Everything related to 3D programming
User avatar
Psychophanta
Addict
Addict
Posts: 4968
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Question: is there possible to make a 100% rigid joint?

Post by Psychophanta »

As we know, 'Joints' are not 100% rigid, but flexible, is there possible to make a 100% rigid joint?

If not, could be possible to add a parameter for the percentage of rigidness when creating a joint?
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 280
Joined: Thu Jul 09, 2015 9:07 am

Re: Question: is there possible to make a 100% rigid joint?

Post by pf shadoko »

I advise you to use only "GenericJoint".
it can replace all other joints
and by default all its attributes are 0
(note: in the doc, the parameters TransformX/Y/Z, mean positionX/Y/Z (attachment point))

see 3D examples: GenericJoint.pb
User avatar
Psychophanta
Addict
Addict
Posts: 4968
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Question: is there possible to make a 100% rigid joint?

Post by Psychophanta »

Interesting. Never tested GenericJoint.
Will test later as soon as possible.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
Psychophanta
Addict
Addict
Posts: 4968
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Question: is there possible to make a 100% rigid joint?

Post by Psychophanta »

pf shadoko wrote: Thu Apr 22, 2021 11:37 am I advise you to use only "GenericJoint".
it can replace all other joints
and by default all its attributes are 0
(note: in the doc, the parameters TransformX/Y/Z, mean positionX/Y/Z (attachment point))

see 3D examples: GenericJoint.pb
Tested.
For the rigid ligatures use attributes: #PB_Joint_NoLimit, #PB_Joint_LowerLimit and #PB_Joint_UpperLimit.
BUT:
Still, the bonds are not solidly attached, they have always some degree of damping.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 280
Joined: Thu Jul 09, 2015 9:07 am

Re: Question: is there possible to make a 100% rigid joint?

Post by pf shadoko »

give an example please
User avatar
Psychophanta
Addict
Addict
Posts: 4968
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Question: is there possible to make a 100% rigid joint?

Post by Psychophanta »

pf shadoko wrote: Fri Apr 23, 2021 9:53 am give an example please
Want to perform this machine, but still not possible:
https://www.youtube.com/watch?v=QhLNtKMME90

Look:

Code: Select all

ExamineDesktops()
RX.u=DesktopWidth(0)*2/3:RY.u=DesktopHeight(0)*2/3
InitEngine3D()
InitMouse():InitSprite():InitKeyboard()
OpenWindow(0,0,0,RX,RY,"test",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Textures",#PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Packs/skybox.zip",#PB_3DArchive_Zip)
Parse3DScripts()
Enumeration; Texturas
  #CuerpoTextura
  #RodamientoTextura
  #BielaTextura
  #SueloTextura
EndEnumeration
Enumeration; Materiales
  #CuerpoMaterial
  #RodamientoMaterial
  #BielaMaterial
  #SueloMaterial
EndEnumeration
Enumeration; Mallas
  #PlataformaMalla
  #RodamientoMalla
  #PesoMalla
  #BielaMalla
EndEnumeration
Enumeration; Entidades
  #Plataforma
  #Biela
  #Pesoi
  #Pesod
  #Rodamientobielai
  #Rodamientobielad
  #Rodamientoi
  #Rodamientod
EndEnumeration
Enumeration; Ligaduras
  #Rodamientobielajuntai
  #Rodamientobielajuntad
  #Rodamientojuntai
  #Rodamientojuntad
EndEnumeration

Global OX.f=0,OY.f=0,OZ.f=0
Global longejeaejedebiela.f=0.5,longejeamasa.f=0.5,distanciaentreejes.f=2,longbiela.f=Sqr(Pow(longejeaejedebiela+longejeamasa,2)+distanciaentreejes*distanciaentreejes),grosorbiela.f=0.08
Global longitudrotor.f=0.15,grosorrotor.f=0.08,grosorpeso.f=longitudrotor;0.4
Global cuerpomasa.f=1.0,cuerpoElasticidad.f=0.58,cuerpoRozamientoDinamico.f=0.91
Global separacionz.f=2*longitudrotor
 
;Texturas y Materiales:
LoadTexture(#CuerpoTextura,"Dirt.jpg")
LoadTexture(#RodamientoTextura,"White.jpg")
LoadTexture(#BielaTextura,"RustySteel.jpg")
CreateMaterial(#CuerpoMaterial,TextureID(#CuerpoTextura))
CreateMaterial(#RodamientoMaterial,TextureID(#RodamientoTextura))
CreateMaterial(#BielaMaterial,TextureID(#BielaTextura))
SetMaterialColor(#CuerpoMaterial,#PB_Material_DiffuseColor,$799ddeca)
SetMaterialColor(#RodamientoMaterial,#PB_Material_DiffuseColor,$9ddeca79)
;luzsuelocieloycamara()
CreateLight(0,$EEEEEE,4,4,2,#PB_Light_Point):SetLightColor(0,#PB_Light_DiffuseColor,$EEEEEE):MoveLight(0,4,4,2,#PB_Absolute)
LoadTexture(#SueloTextura,"Wood.jpg"):CreateMaterial(#SueloMaterial,TextureID(#SueloTextura))
SkyBox("stevecube.jpg")
CreateCamera(0,0,0,100,100)
;mallas()
CreateCylinder(#Rodamientomalla,grosorrotor.f/2,longitudrotor.f,10,1,1); junta de bisagra
TransformMesh(#Rodamientomalla,0,0,0,1,1,1,90,0,0,0):NormalizeMesh(#Rodamientomalla,0):UpdateMeshBoundingBox(#Rodamientomalla)
CreateCylinder(#Bielamalla,grosorbiela/2,longbiela,4,1,1)
CreateCylinder(#Pesomalla,grosorpeso/2,grosorpeso,8,1,1); cuerpo fisico
CreateCube(#PlataformaMalla,2)
;entidades()
CreateEntity(#Plataforma,MeshID(#PlataformaMalla),MaterialID(#SueloMaterial),OX,OY,OZ-separacionz):ScaleEntity(#Plataforma,2,1,0.1,#PB_Absolute)
CreateEntity(#Rodamientoi,MeshID(#Rodamientomalla),MaterialID(#RodamientoMaterial),OX-distanciaentreejes/2,OY,OZ)
CreateEntity(#Rodamientod,MeshID(#Rodamientomalla),MaterialID(#RodamientoMaterial),OX+distanciaentreejes/2,OY,OZ)
CreateEntity(#Rodamientobielai,MeshID(#Rodamientomalla),MaterialID(#RodamientoMaterial))
CreateEntity(#Rodamientobielad,MeshID(#Rodamientomalla),MaterialID(#RodamientoMaterial))
CreateEntity(#Pesoi,MeshID(#Pesomalla),MaterialID(#CuerpoMaterial),OX-distanciaentreejes/2,OY-longejeamasa.f,0)
CreateEntity(#Pesod,MeshID(#Pesomalla),MaterialID(#CuerpoMaterial),OX+distanciaentreejes/2,OY+longejeamasa.f,0)
CreateEntity(#Biela,MeshID(#Bielamalla),MaterialID(#BielaMaterial),OX,OY,OZ-separacionz/2)
AttachEntityObject(#Biela,"",EntityID(#Rodamientobielai)):MoveEntity(#Rodamientobielai,0,longbiela/2,0,#PB_Absolute)
AttachEntityObject(#Biela,"",EntityID(#Rodamientobielad)):MoveEntity(#Rodamientobielad,0,-longbiela/2,0,#PB_Absolute)
CreateEntityBody(#Pesoi,#PB_Entity_BoxBody,cuerpomasa,cuerpoElasticidad,cuerpoRozamientoDinamico)
CreateEntityBody(#Pesod,#PB_Entity_BoxBody,cuerpomasa,cuerpoElasticidad,cuerpoRozamientoDinamico)
CreateEntityBody(#Plataforma,#PB_Entity_StaticBody,0.1,cuerpoElasticidad,cuerpoRozamientoDinamico)
CreateEntityBody(#Biela,#PB_Entity_CylinderBody,0.1,cuerpoElasticidad,cuerpoRozamientoDinamico)
;ligaduras()
GenericJoint(#Rodamientojuntai,EntityID(#Plataforma),-distanciaentreejes/2,0,OZ+separacionz,EntityID(#Pesoi),0,longejeamasa.f,0)
SetJointAttribute(#Rodamientojuntai,#PB_Joint_NoLimit,1,5)  ; <- rotación sobre eje z
;Ligadura entre masa derecha y eje derecho:
GenericJoint(#Rodamientojuntad,EntityID(#Plataforma),distanciaentreejes/2,0,OZ+separacionz,EntityID(#Pesod),0,-longejeamasa,0)
SetJointAttribute(#Rodamientojuntad,#PB_Joint_NoLimit,1,5)  ; <- rotación sobre eje z
;Ligadura entre biela y su eje izquierdo:
GenericJoint(#Rodamientobielajuntai,EntityID(#Biela),0,longbiela/2,OZ+separacionz/2,EntityID(#Pesoi),0,longejeamasa+longejeaejedebiela,0)
SetJointAttribute(#Rodamientobielajuntai,#PB_Joint_NoLimit,1,5)  ; <- rotación sobre eje z
;Ligadura entre biela y su eje derecho:
GenericJoint(#Rodamientobielajuntad,EntityID(#Biela),0,-longbiela/2,OZ+separacionz/2,EntityID(#Pesod),0,-longejeamasa-longejeaejedebiela,0)
SetJointAttribute(#Rodamientobielajuntad,#PB_Joint_NoLimit,1,5)  ; <- rotación sobre eje z
RotateEntity(#Biela,0,0,90-Degree(Atan2(distanciaentreejes,longejeaejedebiela+longejeamasa)),#PB_Absolute)
MoveCamera(0,0,0,5,#PB_Absolute)
Repeat
  ExamineMouse():ExamineKeyboard()
  WaitWindowEvent()
  If KeyboardReleased(#PB_Key_Right)
    ApplyEntityImpulse(#Pesod,0.1,0,0,0,0,0,#PB_Local)
  EndIf
  RenderWorld()
  FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)
Last edited by Psychophanta on Fri Apr 23, 2021 8:30 pm, edited 1 time in total.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 280
Joined: Thu Jul 09, 2015 9:07 am

Re: Question: is there possible to make a 100% rigid joint?

Post by pf shadoko »

I can't run your code without the textures
but anyway I'm not going to examine 1000 lines to try to find the joint problem
(on the other hand, when your program is running I'd like to see this mechanism in motion)

just give me a minimal example to see the problem with the joint

in the video of the pertpetual movement I see only one type of joint
rotation on 1 axis
SetJointAttribute( joint , #PB_Joint_NoLimit, 0, 3 / 4 or 5)

that said, the pieces receiving several constraints simultaneously, I think you must necessarily leave them a little backlash
your biel must be positioned very precisely

if I remember well, the physics engine must be activated after the positioning of the pieces
User avatar
Psychophanta
Addict
Addict
Posts: 4968
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Question: is there possible to make a 100% rigid joint?

Post by Psychophanta »

pf shadoko wrote: Fri Apr 23, 2021 2:46 pm I can't run your code without the textures
but anyway I'm not going to examine 1000 lines to try to find the joint problem
(on the other hand, when your program is running I'd like to see this mechanism in motion)

just give me a minimal example to see the problem with the joint

in the video of the pertpetual movement I see only one type of joint
rotation on 1 axis
SetJointAttribute( joint , #PB_Joint_NoLimit, 0, 3 / 4 or 5)

that said, the pieces receiving several constraints simultaneously, I think you must necessarily leave them a little backlash
your biel must be positioned very precisely

if I remember well, the physics engine must be activated after the positioning of the pieces
Ok, don't worry, will do today or tomorrow, the smallest tip as possible.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
Psychophanta
Addict
Addict
Posts: 4968
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Question: is there possible to make a 100% rigid joint?

Post by Psychophanta »

There you have it, in my post. As you can see, not rigidness at all.
pf shadoko wrote: Fri Apr 23, 2021 2:46 pm if I remember well, the physics engine must be activated after the positioning of the pieces
physics engine is activated by default. Should be deactivated before create the 'joints'?
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 280
Joined: Thu Jul 09, 2015 9:07 am

Re: Question: is there possible to make a 100% rigid joint?

Post by pf shadoko »

EnableWorldPhysics(0)

create the scene

EnableWorldPhysics(1)
User avatar
Psychophanta
Addict
Addict
Posts: 4968
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: Question: is there possible to make a 100% rigid joint?

Post by Psychophanta »

pf shadoko wrote: Wed Apr 28, 2021 11:16 pm EnableWorldPhysics(0)

create the scene

EnableWorldPhysics(1)
Done.
Result:
Exactly THE SAME :( :?
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Post Reply