[Solved] ApplyEntityTorqueImpulse() & ApplyEntityTorque()
Posted: Thu Sep 03, 2015 10:56 pm
[PB 4.40 Beta 2)
Hello. I see no difference with these two functions. Only the values of x, y or z change.
- Press space bar for a pulse - Esc for exit.I am a beginner in 3D. If anyone can show me the differences (with codes). Thanks.
Hello. I see no difference with these two functions. Only the values of x, y or z change.
- Press space bar for a pulse - Esc for exit.
Code: Select all
Enumeration
#Mainform
EndEnumeration
InitEngine3D() : InitKeyboard() : InitSprite() : InitMouse()
OpenWindow(#Mainform,0,0, 1024, 768, "[PB 5.40 - ApplyEntityTorque", #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(#Mainform),0,0,1024,768,0, 0, 0)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
;Light & Shadow
CreateLight(#PB_Any,RGB(255, 255, 255), -5000, 2000, 1500)
WorldShadows(#PB_Shadow_Additive)
;Camera
CreateCamera(0, 0, 0, 100,100)
CameraBackColor(0, RGB(145, 182, 201))
MoveCamera(0, 3, 5, 20, #PB_Absolute)
CameraLookAt(0, 0,1,0)
;Ground
Mesh = CreatePlane(#PB_Any, 40, 40, 10, 10, 2, 2)
Material = CreateMaterial(#PB_Any, TextureID(LoadTexture(#PB_Any, "MRAMOR6X6.jpg")))
Ground = CreateEntity(#PB_Any, MeshID(Mesh), MaterialID(material))
CreateEntityBody(Ground, #PB_Entity_StaticBody)
;Cube
Mesh = CreateCube(#PB_Any, 2)
Material = CreateMaterial(#PB_Any, TextureID(LoadTexture(#PB_Any, "soil_wall.jpg")))
CubeA = CreateEntity(#PB_Any, MeshID(Mesh), MaterialID(Material), -2, 1, 0)
CreateEntityBody(CubeA, #PB_Entity_BoxBody, 0.1, 0.1, 0.1)
CubeB = CreateEntity(#PB_Any, MeshID(Mesh), MaterialID(Material), 2, 1, 0)
CreateEntityBody(CubeB, #PB_Entity_BoxBody, 0.1, 0.1, 0.1)
Repeat
Repeat : Until WindowEvent() = 0
If ExamineKeyboard()
If KeyboardPushed (#PB_Key_Escape)
Break
EndIf
If KeyboardReleased (#PB_Key_Space)
;WorkAround : Wake up entities
DisableEntityBody(CubeA, #False)
DisableEntityBody(CubeB, #False)
ApplyEntityTorqueImpulse(CubeA, 0.8, 0, 0)
ApplyEntityTorque(CubeB, 20, 0, 0)
EndIf
EndIf
RenderWorld(40)
FlipBuffers()
ForEver