MoveEntity / RotateEntity 5.00 b8

Everything related to 3D programming
Thade
Enthusiast
Enthusiast
Posts: 266
Joined: Sun Aug 03, 2003 12:06 am
Location: Austria

MoveEntity / RotateEntity 5.00 b8

Post 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
--------------
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: MoveEntity / RotateEntity 5.00 b8

Post by Comtois »

Thade wrote:Is that as it should be?
About what ?
Please correct my english
http://purebasic.developpez.com/
Thade
Enthusiast
Enthusiast
Posts: 266
Joined: Sun Aug 03, 2003 12:06 am
Location: Austria

Re: MoveEntity / RotateEntity 5.00 b8

Post 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.
--------------
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: MoveEntity / RotateEntity 5.00 b8

Post 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.
Please correct my english
http://purebasic.developpez.com/
Thade
Enthusiast
Enthusiast
Posts: 266
Joined: Sun Aug 03, 2003 12:06 am
Location: Austria

Re: MoveEntity / RotateEntity 5.00 b8

Post by Thade »

Ok thanks for the explanation. :)
--------------
Yes, its an Irish Wolfhound.
Height: 107 cm; Weight: 88 kg
User avatar
Comtois
Addict
Addict
Posts: 1432
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: MoveEntity / RotateEntity 5.00 b8

Post 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
Please correct my english
http://purebasic.developpez.com/
Post Reply