Page 1 of 1

MoveEntity / RotateEntity 5.00 b8

Posted: Wed Oct 31, 2012 8:31 pm
by Thade
Is that as it should be?

File Examples/3D/Entity.pb

Insert

Code: Select all

RotateEntity(0, 0, 0.1, 0, #PB_Relative)
MoveEntity(0, 0, 0, -0.1, #PB_Relative)
at Line 77

Re: MoveEntity / RotateEntity 5.00 b8

Posted: Wed Oct 31, 2012 9:51 pm
by Comtois
Thade wrote:Is that as it should be?
About what ?

Re: MoveEntity / RotateEntity 5.00 b8

Posted: Wed Oct 31, 2012 10:27 pm
by Thade
The (don't know how to translate those red/green/blue Markers which are at start at the Bone Positions into english) do not move with the Entity.

Re: MoveEntity / RotateEntity 5.00 b8

Posted: Wed Oct 31, 2012 10:33 pm
by Comtois
Ok i was not sure because the title was about MoveEntity and RotateEntity.

Extract from Ogre :
// HACK To display bones
// This won't work if the entity is not centered at the origin
// TODO work out a way To allow bones To be rendered when Entity Not centered

DisplaySkeleton is Not perfect, but can help For Debug purpose.

So yes it seem it is like it should.

Re: MoveEntity / RotateEntity 5.00 b8

Posted: Wed Oct 31, 2012 10:41 pm
by Thade
Ok thanks for the explanation. :)

Re: MoveEntity / RotateEntity 5.00 b8

Posted: Sun Nov 04, 2012 9:44 am
by Comtois
forgot to say than you can use EntityBoneX/Y/Z()

Code: Select all

#CameraSpeed = 1

IncludeFile "Screen3DRequester.pb"

Define.f KeyX, KeyY, MouseX, MouseY, RollZ

Declare DisplayBone()

If InitEngine3D()
  
  Add3DArchive("Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive("Data/Scripts" , #PB_3DArchive_FileSystem)
  Add3DArchive("Data/Models"  , #PB_3DArchive_FileSystem)
  Add3DArchive("Data/Packs/skybox.zip", #PB_3DArchive_Zip)
  Parse3DScripts()
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
    LoadMesh(0, "robot.mesh")
    CreateCube(1, 0.5)
    
    CreateMaterial(0, LoadTexture(0, "clouds.jpg"))
    MaterialShadingMode(0, #PB_Material_Wireframe)
    GetScriptMaterial(1, "Color/Red")
    MaterialSelfIlluminationColor(1, RGB(255, 255, 55))
    
    
    CreateEntity(0, MeshID(0), MaterialID(0))
    StartEntityAnimation(0, "Walk")
    
    For i = 1 To 18
      CreateEntity(i, MeshID(1), MaterialID(1))
    Next i
    
    SkyBox("stevecube.jpg")
    
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0, 0, 40, 150)
    
    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    
        
      EndIf
      RotateEntity(0, 0, 1, 0, #PB_Relative)
      MoveEntity(0, 0.5, 0, 0.0, #PB_Local)
      DisplayBone()
      
      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

Procedure DisplayBone()
  For i=1 To 18
    Bone$ = "Joint"+Str(i)
    EntityLocate(i, EntityBoneX(0, Bone$),  EntityBoneY(0, Bone$),  EntityBoneZ(0, Bone$))
  Next  
EndProcedure