Yes, I've tried some of those approaches, but need to resolve everything so that I can Point() each the character at their opponent. I'll paste in my current code (and comments) below. Ideally, I'd like to go with your suggestion...
Quote: "The simplest way to fix this is to open the model in the viewer and rotate it 180 degrees then save it"
...and have been able to pull it off in Blender, but not with The Game Creators products, including the Character Shop and AC3D demos I just grabbed. Please advise on what "the viewer" is - that sounds like the tool for me. The only tool I have right now is VB.NET for VS 2008. Thanks very much for the speedy reply. Looking forward to getting these little guys turned around and fighting each other soon.
***Application.vb
Imports DarkGDK
Imports DarkGDK.Camera
Imports FightSim.Character
Public Class Application
'Private Shared colonel As DarkGDK.Basic3D.Object3D '= New DarkGDK.Basic3D.Object3D("Colonel-X.X")
Private Const TEAM_NUM As Integer = 0
Public Shared Sub GameLoop()
Dim i As Integer, j As Integer
'Initialize media
DarkGDK.IO.File.SetCurrentDirectory("..\..\Media")
DarkGDK.Camera.DefaultCamera.SetRange(1.0F, 30000.0F)
'Initialize terrain
Dim oTerrain As DarkGDK.World.Terrain, oImages(2) As DarkGDK.Basic2D.Image
oTerrain = New DarkGDK.World.Terrain()
oTerrain.HeightMap("map.bmp") '256 x 256
oTerrain.Scale(1.0F, 0.2F, 1.0F)
oTerrain.Light(1.0F, -0.25F, 0.0F, 1.0F, 1.0F, 0.78F, 0.5F)
oImages(0) = New DarkGDK.Basic2D.Image("texture.jpg")
oImages(1) = New DarkGDK.Basic2D.Image("detail.jpg")
oTerrain.Texture(oImages(0), oImages(1))
'oTerrain.Split(6) '??
oTerrain.Build()
Dim oSky As DarkGDK.Basic3D.Object3D
oSky = New DarkGDK.Basic3D.Object3D("Skybox\skybox2.x")
oSky.AffectedByAnyLights = False
oSky.Scale(7500.0F, 7500.0F, 7500.0F)
oSky.SetTexture(Basic3D.TextureWrapMode.Clamp, 2)
'Initialize character teams
Dim TeamA(TEAM_NUM) As Character
Dim TeamB(TEAM_NUM) As Character
j = 0
For i = 0 To TEAM_NUM 'TODO: throw error if no animation file found
TeamA(i) = New Character("Characters\ColonelX\Colonel-X.X")
'TeamA(i) = New Character("Characters\Knight\L-Knight-Move.x")
'TeamA(i) = New Character("Characters\HelloWorld\HelloWorld.3ds")
'TeamA(i) = New Character("Characters\HelloWorld\fighter2.x")
'TeamA(i) = New Character("Characters\Ninja\L-Ninja-Move.x")
'TeamA(i) = New Character("Characters\Fleur\fleurOptonl.3ds") '3ds does not work
'TeamA(i) = New Character("Characters\Fleur\fleurOptonl.x") 'from Blender, corrects orientation issue with DarkMatter models
'TeamA(i) = New Character("Characters\Test\Test.x")
'TeamA(i).Position(5 + j, 0, 5 - j)
'TeamA(i).Position((2 + j) + 10, 0, (2 - j) + 10)
'TeamA(i).Position((2 + j) + 50, 0, (2 - j) + 50)
'TeamA(i).Position((2 * j) + 180, 0, (2 * j) + 180)
TeamA(i).Position(CSng(Int((256 * Rnd()) + 1)), 0, CSng(Int((256 * Rnd()) + 1)))
TeamA(i).IsMoving = True
'MakeRotatingCollisionBox(TeamA(i)) 'required?
j += 5 '10
Next
j = 0
For i = 0 To TEAM_NUM
'TeamB(i) = New Character("Characters\Ninja\L-Ninja-Move.x")
'TeamB(i) = New Character("Characters\Fleur\fleurOptonl.x") 'from Blender, corrects orientation issue with DarkMatter models
'TeamB(i) = New Character("Characters\Shin\shin_001.x") 'from Blender, corrects orientation issue with DarkMatter models, has its own issue with giant boundary box
'TeamB(i) = New Character("Characters\Test\Test.x")
'TeamB(i) = New Character("Characters\DefaultMale\default_male.x") 'Inivis A3CD sample model http://www.thegamecreators.com/?m=view_product&id=2092
TeamB(i) = New Character("Characters\Ranger\export.x")
'TeamB(i).Position(90 + j, 0, 90 - j)
'TeamB(i).Position((2 + j) + 90, 0, (2 - j) + 90)
'TeamB(i).Position((2 + j) + 90, 0, (2 - j) + 90)
'TeamB(i).Position((2 * j) + 180, 0, (2 * j) + 180)
'TeamB(i).Position((2 + j) + 50, 0, (2 - j) + 50)
TeamB(i).Position(0, 0, 0)
'TeamB(i).Position(CSng(Int((256 * Rnd()) + 1)), 0, CSng(Int((256 * Rnd()) + 1)))
TeamB(i).IsMoving = True
'MakeRotatingCollisionBox(TeamB(i)) 'required?
'TeamB(i).Point(TeamB(i).X + 1, TeamB(i).Y, TeamB(i).Z + 1) 'comment this
j += 10
Next
'Mark opponents, mano a mano
For i = 0 To TEAM_NUM
TeamB(i).SetOpponent(TeamA(i))
TeamA(i).SetOpponent(TeamB(i))
Next
'Initialize camera
Dim fCameraHeight As Single
DarkGDK.Camera.DefaultCamera.PositionCurrent(-25, 0, -25) '(16, 0, 64) '(128, 0, 128)
DarkGDK.Camera.DefaultCamera.RotateCurrent(0, 45, 0) '(0, 115, 0)
While DarkGDK.Engine.LoopGDK()
'Characters take turns
For i = 0 To TEAM_NUM
TeamB(i).TakeTurn()
TeamA(i).TakeTurn()
Next
'Handle camera
DarkGDK.Camera.DefaultCamera.ControlDefaultUsingArrowKeys(2.0F, 2.0F)
fCameraHeight = oTerrain.HeightAt(DarkGDK.Camera.DefaultCamera.CurrentPositionX, DarkGDK.Camera.DefaultCamera.CurrentPositionZ)
DarkGDK.Camera.DefaultCamera.PositionCurrent(DarkGDK.Camera.DefaultCamera.CurrentPositionX, fCameraHeight + 10.0F, DarkGDK.Camera.DefaultCamera.CurrentPositionZ)
DarkGDK.World.Terrain.Update()
'Sync
DarkGDK.Core.Sync()
End While
End Sub
Shared Sub MakeRotatingCollisionBox(ByRef o As DarkGDK.Basic3D.Object3D)
Dim sx As Single = o.SizeX / 2.0
Dim sy As Single = o.SizeY / 2.0
Dim sz As Single = o.SizeZ / 2.0
o.MakeCollisionBox(0 - sx, 0 - sy, 0 - sz, sx, sy, sz, True)
End Sub
End Class
***Character.vb
Imports FightSim.BO.NewDataSet
Imports System.Math
Public Class Character
Inherits DarkGDK.Basic3D.Object3D
'Type/class tracking
Enum CharacterTypeEnum
ColonelX
Ninja
Knight
HelloWorld
End Enum
Public Sub New(ByVal sAnimationFile As String)
'Constructor call is valid only as the first statement in an instance constructor.
MyBase.New(sAnimationFile) '"You must specify a model in the X, 3DS, MDL, MD2 or MD3 format."
Try
'Initialize character record, set AnimationFile property
moBo = New FightSim.BO.NewDataSet
moCharacterRecord = moBo.Character.NewCharacterRow
moCharacterRecord.AnimationFile = sAnimationFile
'Load specified animation file, throw error if not supported
Select Case sAnimationFile
Case "Characters\Ranger\export.x"
Me.Scale(550, 550, 550)
Me.LoopAnimation(72, 96)
'Me.ShowBounds() 'nifty
'Me.FixPivot()
'Me.RotationMode = DarkGDK.Basic3D.ObjectRotationMode.ZYX
'Me.Rotate(0, 0, 0)
Case "Characters\Shin\shin_001.x"
Case "Characters\Test\Test.x"
Me.Scale(4000, 4000, 4000)
'Me.Scale(450, 450, 450)
'Me.Scale(12, 12, 12)
'Me.Rotate(0, 0, 0)
'Me.MoveUp(10)
'Me.AnimationSpeed = 50
'Me.Position(Me.X, 500, Me.Z)
Me.LoopAnimation()
Case "Characters\DefaultMale\default_male.x"
Me.Scale(2000, 2000, 2000)
Case "Characters\Fleur\fleurOptonl.3ds", "Characters\Fleur\fleurOptonl.x" 'Declare enums?
Me.Scale(30, 30, 30)
Me.Emissive = Drawing.Color.DarkMagenta
'Me.Diffuse = Drawing.Color.AliceBlue
Me.GhostOn()
'Me.LoopAnimation()
Case "Characters\HelloWorld\HelloWorld.3ds"
'Me.AnimationSpeed = 1
'Me.LoopAnimation()
'Me.Position(Me.X, 500.0F, Me.Z)
Case "Characters\ColonelX\Colonel-X.X" : Me.CharacterType = CharacterTypeEnum.ColonelX
Me.Scale(12, 12, 12)
Me.AnimationSpeed = 40
Me.LoopAnimation(757, 781) 'Weapon Crouched Move Slow (same)
Case "Characters\Ninja\L-Ninja-Move.x" : Me.CharacterType = CharacterTypeEnum.Ninja
Me.Scale(450, 450, 450) '(900, 900, 900)
Me.AnimationSpeed = 40
'Me.AppendAnimation("Characters\Ninja\L-Ninja-Attack1.x") '1
'Me.AppendAnimation("Characters\Ninja\L-Ninja-Die.x") '2
'Me.AppendAnimation("Characters\Ninja\L-Ninja-Idle.x") '3
'Me.AppendAnimation("Characters\Ninja\L-Ninja-Impact.x") '4
'Me.AppendAnimation("Characters\Ninja\L-Ninja-Static.x") '5
Me.LoopAnimation() 'Move
Case "Characters\Knight\L-Knight-Move.x" : Me.CharacterType = CharacterTypeEnum.Knight
Me.Scale(450, 450, 450) '(900, 900, 900)
Me.AnimationSpeed = 40
Me.LoopAnimation() 'Move
Case Else
Throw New Exception("Invalid BaseAnimationType reference:" & sAnimationFile)
End Select
'???
'Me.FixPivot()
'Me.RotationMode = DarkGDK.Basic3D.ObjectRotationMode.XYZ
Catch ex As Exception
Throw ex
End Try
End Sub
'Database field/BO Character Record tracking
Private moCharacterType As CharacterTypeEnum
Private moBo As FightSim.BO.NewDataSet
Private moCharacterRecord As FightSim.BO.NewDataSet.CharacterRow
Public Property CharacterType() As CharacterTypeEnum
Get
Return moCharacterType
End Get
Set(ByVal value As CharacterTypeEnum)
moCharacterType = value
End Set
End Property
'Other tracking variables
Private mbIsMoving As Boolean = False
Public Property IsMoving() As Boolean
Get
Return mbIsMoving
End Get
Set(ByVal value As Boolean)
mbIsMoving = value
End Set
End Property
Private moOpponent As FightSim.Character
Public Sub SetOpponent(ByRef value As FightSim.Character)
moOpponent = value
Me.Point(moOpponent.X, moOpponent.Y, moOpponent.Z) 'THE CODE THAT WORKS
'misc
'Me.SetOrientation(moOpponent) 'For backward models such as Ninja, this flips them forward and makes them move backward:
'Me.SetOrientation(value)
'Me.Point(moOpponent.Z, moOpponent.Y, moOpponent.X)
'Me.SetOrientation(moOpponent)
'moOpponent.SetOrientation(Me)
'Me.ZRotate(moOpponent.Z)
'Me.ZRotate(Me.Z + 1)
'Me.XRotate(moOpponent.X)
'Me.YRotate(moOpponent.Y)
'Me.ZRotate(moOpponent.Z)
'Me.XRotate(moOpponent.AngleX)
'Me.ZRotate(moOpponent.AngleZ)
'Me.FixPivot()
End Sub
Public Sub TakeTurn()
'Resolve collisions
' with Opponents
If Not moOpponent Is Nothing Then
If Me.Collision(moOpponent) Then
If mbIsMoving Then
mbIsMoving = False
'RESTORE THIS: Me.StopAnimation()
End If
End If
End If
' with Battlefield boundary
'If (Me.X < 0 Or Me.X >= 256) Or (Me.Z < 0 Or Me.Z >= 256) Then
' Me.IsMoving = False
' Me.StopAnimation()
'End If
'works
'If (Me.X < 0 Or Me.X >= 256) Or (Me.Z < 0 Or Me.Z >= 256) Then
' Me.Point(Me.X - 1, 0, Me.Z - 1)
'End If
'If Me.X < 0 Then Me.Point(Me.X + 1, 0, Me.Z + 1)
'If Me.Z < 0 Then Me.Point(Me.X + 1, 0, Me.Z + 1)
'If Me.X >= 256 Then Me.Point(Me.X - 1, 0, Me.Z - 1)
'If Me.Z >= 256 Then Me.Point(Me.X - 1, 0, Me.Z - 1)
'If Me.X < 0 Or Me.X >= 256 Then Me.Point(Me.X - 1, 0, Me.Z + 1)
'If (Me.X < 0 Or Me.X >= 256) Or (Me.Z < 0 Or Me.Z >= 256) Then Me.Point(Me.X - 1, 0, Me.Z - 1)
'If (Me.X < 0 Or Me.X >= 256) Or (Me.Z < 0 Or Me.Z >= 256) Then
' Me.Point(Abs(256 - Me.X), 0, Abs(256 - Me.Z))
'End If
'If (Me.X < 0 Or Me.X >= 256) Or (Me.Z < 0 Or Me.Z >= 256) Then Me.TurnRight(180)
'If Me.X < 0 Or Me.X >= 256 Then Me.Point(Me.X - 256, 0, 0)
'If Me.Z < 0 Then
' 'Me.TurnRight(180)
' Me.Position(Me.X, Me.Y, 0)
' 'Me.Point(Me.X, Me.Y, 1)
' 'Me.Point(Me.X, Me.Y, 360 - Me.Z)
' 'Me.Point(Me.X, Me.Y, 1)
' 'Me.Point(0, Me.Y, 0)
' Me.Point(-1, Me.Y, -1)
'End If
'Move
If Me.IsMoving Then Me.Move(1)
End Sub
End Class
'Case CharacterTypeEnum.ColonelX
'Play appropriate animation - this list was compiled from the lists on http://forum.thegamecreators.com/?m=forum_view&t=143711&b=22 and http://en.wikibooks.org/wiki/FPI_Script
'colonel.LoopAnimation(190, 209) ' 0 = Spawn
'colonel.LoopAnimation(210, 234) ' 1 = Idle
'colonel.LoopAnimation(235, 259) ' 2 = Move Slow
'colonel.LoopAnimation(260, 279) ' 3 = Strafe Left
'colonel.LoopAnimation(280, 299) ' 4 = Strafe Right
'colonel.LoopAnimation(300, 318) ' 5 = Move Fast
'colonel.LoopAnimation(319, 355) ' 6 = Reload Weapon (or Toss)
'colonel.LoopAnimation(0, 19) '11 = Impact Front
'colonel.LoopAnimation(20, 39) '12 = Bounce Front
'colonel.LoopAnimation(493, 522) '13 = Get Up Front
'colonel.LoopAnimation(40, 59) '14 = Impact Back
'colonel.LoopAnimation(60, 79) '15 = Bounce Back
'colonel.LoopAnimation(523, 552) '16 = Get Up Back
'colonel.LoopAnimation(120, 139) '17 = Impact Left
'colonel.LoopAnimation(140, 159) '18 = Bounce Left
'colonel.LoopAnimation(80, 99) '20 = Impact Right
'colonel.LoopAnimation(100, 119) '21 = Bounce Right
'colonel.LoopAnimation(356, 380) '31 = Crouched Idle
'colonel.LoopAnimation(381, 405) '32 = Crouched Move Slow (same) **
'colonel.LoopAnimation(381, 405) '33 = Crouched Strafe Left (same)
'colonel.LoopAnimation(381, 405) '34 = Crouched Strafe Right (same)
'colonel.LoopAnimation(381, 405) '35 = Crouched Move Fast (same) **
'colonel.LoopAnimation(406, 442) '36 = Crouched Reload Weapon (or toss)
'colonel.LoopAnimation(443, 462) '40 = Freeform Idle
'colonel.LoopAnimation(463, 492) '41 = Freeform Move
'colonel.LoopAnimation(553, 572) '50 = Weapon Spawn
'colonel.LoopAnimation(573, 597) '51 = Weapon Idle
'colonel.LoopAnimation(598, 622) '52 = Weapon Move Slow
'colonel.LoopAnimation(623, 642) '53 = Weapon Strafe Left
'colonel.LoopAnimation(643, 662) '54 = Weapon Strafe Right
'colonel.LoopAnimation(663, 681) '55 = Weapon Move Fast
'colonel.LoopAnimation(682, 731) '56 = Weapon Reload Weapon (or Toss)
'colonel.LoopAnimation(160, 189) '57 = Weapon NEW Climb
'colonel.LoopAnimation(0, 19) '61 = Weapon Impact Front
'colonel.LoopAnimation(20, 39) '62 = Weapon Bounce Front
'colonel.LoopAnimation(882, 911) '63 = Weapon Get Up Front
'colonel.LoopAnimation(40, 59) '64 = Weapon Impact Back
'colonel.LoopAnimation(60, 79) '65 = Weapon Bounce Back
'colonel.LoopAnimation(912, 941) '66 = Weapon Get Up Back
'colonel.LoopAnimation(120, 139) '67 = Weapon Impact Left
'colonel.LoopAnimation(140, 159) '68 = Weapon Bounce Left
'colonel.LoopAnimation(80, 99) '70 = Weapon Impact Right
'colonel.LoopAnimation(100, 119) '71 = Weapon Bounce Right
'colonel.LoopAnimation(732, 756) '81 = Weapon Crouched Idle
'colonel.LoopAnimation(757, 781) '82 = Weapon Crouched Move Slow (same)
'colonel.LoopAnimation(757, 781) '83 = Weapon Crouched Strafe Left (same)
'colonel.LoopAnimation(757, 781) '84 = Weapon Crouched Strafe Right (same)
'Me.LoopAnimation(757, 781) '85 = Weapon Crouched Move Fast (same)
'colonel.LoopAnimation(782, 831) '86 = Weapon Crouched Reload Weapon (or toss)
'colonel.LoopAnimation(832, 851) '90 = Weapon Freeform Idle
'colonel.LoopAnimation(852, 881) '91 = Weapon Freeform Move
'Public Property Opponent() As FightSim.Character
' Get
' Return Me 'moOpponent
' End Get
' Set(ByVal value As FightSim.Character)
' moOpponent = value
' 'Me.Point(Abs(Me.X) - Abs(moOpponent.X), 0, Abs(Me.Z) - Abs(moOpponent.Z))
' 'Me.Point(Abs(Me.X - moOpponent.X), 0, Abs(Me.Z - moOpponent.Z))
' 'Me.Point(Me.X - moOpponent.X, 0, Me.Z - moOpponent.Z)
' 'Me.Point(360 - moOpponent.X, 0, 360 - moOpponent.Z) 'knights run away from ninjas
' 'Me.Point(360 - Abs(moOpponent.X), 0, 360 - Abs(moOpponent.Z)) 'knights run away from ninjas
' 'Me.Point(Abs(Me.Z - moOpponent.X), 0, Abs(Me.X - moOpponent.Z))
' 'Me.Point(Me.X - moOpponent.X, 0, Me.Z - moOpponent.Z)
' 'Me.Point(moOpponent.Z, 0, moOpponent.X)
' 'Me.Point(128, 0, 128)
' 'Me.Point(Abs(360 - moOpponent.X), 0, Abs(360 - moOpponent.Z))
' 'Me.Point(moOpponent.X - moOpponent.Z, 0, moOpponent.Z - moOpponent.X)
' Me.Point(moOpponent.X, moOpponent.Y, moOpponent.Z) 'this works, but dudes are facing backwards
' 'Me.TurnRight(Abs(moOpponent.X - Me.X))
' End Set
'End Property