Problems with down scaling a entity.
Posted: Tue Jul 15, 2014 11:17 pm
Don't know if it's a bug or me just not knowing what I'll doing. Here I'm having trouble with scaling down a entity with a variable. It works fine if I use values instead. Some code below to help. Use the keys 1-6 to change the scale of the entity. Tested with PB 5.30 Beta 7 on Win XP(x86). Thanks for any help.
Key 1 use scale of 0.5 with variable with results of scale of 1.0?
Key 2 use scale of 0.5 with values with good results.
Key 3 use scale of 1.0 with variable return to original scale.
Key 4 use scale of 1.5 with variable with good results.
Key 5 use scale of 0.09 with variable with the entity going in hiding.
Key 6 use scale of 0.09 with value with good results.
Key 1 use scale of 0.5 with variable with results of scale of 1.0?
Key 2 use scale of 0.5 with values with good results.
Key 3 use scale of 1.0 with variable return to original scale.
Key 4 use scale of 1.5 with variable with good results.
Key 5 use scale of 0.09 with variable with the entity going in hiding.
Key 6 use scale of 0.09 with value with good results.
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Entity
;
; (c) 2002 - Fantaisie Software
;
; ------------------------------------------------------------
;
#CameraSpeed = 1
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY, RollZ
pp = 1.0
If InitEngine3D()
Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive("Data/Packs/skybox.zip", #PB_3DArchive_Zip)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
LoadMesh(0, "robot.mesh")
CreateMaterial(1, LoadTexture(0, "clouds.jpg"))
CreateEntity(1, MeshID(0), MaterialID(1), 0, 0, 0)
StartEntityAnimation(1, "Walk")
SkyBox("stevecube.jpg")
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 40, 150, #PB_Absolute)
Repeat
Screen3DEvents()
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
If KeyboardPushed(#PB_Key_1)
pp = 0.5
ScaleEntity(1, pp, pp, pp, #PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_2)
ScaleEntity(1, 0.5, 0.5, 0.5, #PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_3)
pp = 1.0
ScaleEntity(1, pp, pp, pp, #PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_4)
pp = 1.5
ScaleEntity(1, pp, pp, pp, #PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_5)
pp = 0.09
ScaleEntity(1, pp, pp, pp, #PB_Absolute)
ElseIf KeyboardPushed(#PB_Key_6)
ScaleEntity(1, 0.09, 0.09, 0.09, #PB_Absolute)
EndIf
EndIf
RotateEntity(1, 0, 1, 0, #PB_Relative)
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End