diff --git a/assets/assets.go b/assets/assets.go index c13947d..4368cbf 100644 --- a/assets/assets.go +++ b/assets/assets.go @@ -45,15 +45,12 @@ func LoadModels() ([]types.ModelAsset, error) { goonerModel.Transform = transform // Coomer model (ready for animations) - coomerModel := rl.LoadModel("resources/models/coomer.obj") - coomerTexture := rl.LoadTexture("resources/models/coomer.png") - rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture) + coomerModel := rl.LoadModel("resources/models/coomer/idle_notransy.glb") + // coomerTexture := rl.LoadTexture("resources/models/coomer.png") + // rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture) // When you have animations, add them like: - // coomerAnims, _ := loadModelAnimations("resources/models/coomer.glb", - // map[string]string{ - // "idle": "resources/models/coomer_idle.glb", - // "walk": "resources/models/coomer_walk.glb", - // }) + coomerAnims, _ := loadModelAnimations(map[string]string{"idle": "resources/models/coomer/idle_notransy.glb", "walk": "resources/models/coomer/unsteadywalk_notransy.glb"}) + coomerModel.Transform = transform // Shreke model (ready for animations) shrekeModel := rl.LoadModel("resources/models/shreke.obj") @@ -69,11 +66,18 @@ func LoadModels() ([]types.ModelAsset, error) { return []types.ModelAsset{ { Model: goonerModel, - Animation: append(goonerAnims.Idle, goonerAnims.Walk...), // For compatibility + Animation: append(goonerAnims.Idle, goonerAnims.Walk...), AnimFrames: int32(len(goonerAnims.Idle) + len(goonerAnims.Walk)), Animations: goonerAnims, + YOffset: 0.0, + }, + { + Model: coomerModel, + Animation: append(coomerAnims.Idle, coomerAnims.Walk...), + AnimFrames: int32(len(coomerAnims.Idle) + len(coomerAnims.Walk)), + Animations: coomerAnims, + YOffset: -4.0, }, - {Model: coomerModel, Texture: coomerTexture}, {Model: shrekeModel, Texture: shrekeTexture}, }, nil } diff --git a/game/game.go b/game/game.go index 3f82b45..2a26f9a 100644 --- a/game/game.go +++ b/game/game.go @@ -154,26 +154,26 @@ func (g *Game) DrawPlayer(player *types.Player, model rl.Model) { defer player.Unlock() grid := GetMapGrid() + modelIndex := int(player.ID) % len(g.Models) + modelAsset := g.Models[modelIndex] + + const defaultHeight = 8.0 // Default height above tile, fine tune per model in types.ModelAsset playerPos := rl.Vector3{ X: player.PosActual.X, - Y: grid[player.PosTile.X][player.PosTile.Y].Height*types.TileHeight + 16.0, + Y: grid[player.PosTile.X][player.PosTile.Y].Height*types.TileHeight + defaultHeight + modelAsset.YOffset, Z: player.PosActual.Z, } - if player.ID%int32(len(g.Models)) == 0 { - modelAsset := g.Models[0] - - // Check if model has animations - if modelAsset.Animations.Idle != nil || modelAsset.Animations.Walk != nil { - if player.IsMoving && len(modelAsset.Animations.Walk) > 0 { - anim := modelAsset.Animations.Walk[0] // Use first walk animation - player.AnimationFrame = player.AnimationFrame % anim.FrameCount - rl.UpdateModelAnimation(model, anim, player.AnimationFrame) - } else if len(modelAsset.Animations.Idle) > 0 { - anim := modelAsset.Animations.Idle[0] // Use first idle animation - player.AnimationFrame = player.AnimationFrame % anim.FrameCount - rl.UpdateModelAnimation(model, anim, player.AnimationFrame) - } + // Check if model has animations + if modelAsset.Animations.Idle != nil || modelAsset.Animations.Walk != nil { + if player.IsMoving && len(modelAsset.Animations.Walk) > 0 { + anim := modelAsset.Animations.Walk[0] // Use first walk animation + player.AnimationFrame = player.AnimationFrame % anim.FrameCount + rl.UpdateModelAnimation(model, anim, player.AnimationFrame) + } else if len(modelAsset.Animations.Idle) > 0 { + anim := modelAsset.Animations.Idle[0] // Use first idle animation + player.AnimationFrame = player.AnimationFrame % anim.FrameCount + rl.UpdateModelAnimation(model, anim, player.AnimationFrame) } } diff --git a/resources/models/coomer/Animation_Confused_Scratch_withSkin.glb b/resources/models/coomer/Animation_Confused_Scratch_withSkin.glb new file mode 100644 index 0000000..d22dd48 Binary files /dev/null and b/resources/models/coomer/Animation_Confused_Scratch_withSkin.glb differ diff --git a/resources/models/coomer/Animation_Idle_withSkin.glb b/resources/models/coomer/Animation_Idle_withSkin.glb new file mode 100644 index 0000000..2147b02 Binary files /dev/null and b/resources/models/coomer/Animation_Idle_withSkin.glb differ diff --git a/resources/models/coomer/Animation_Running_withSkin.glb b/resources/models/coomer/Animation_Running_withSkin.glb new file mode 100644 index 0000000..eecd93f Binary files /dev/null and b/resources/models/coomer/Animation_Running_withSkin.glb differ diff --git a/resources/models/coomer/Animation_Unsteady_Walk_withSkin.glb b/resources/models/coomer/Animation_Unsteady_Walk_withSkin.glb new file mode 100644 index 0000000..de7bc85 Binary files /dev/null and b/resources/models/coomer/Animation_Unsteady_Walk_withSkin.glb differ diff --git a/resources/models/coomer/Animation_Walking_withSkin.glb b/resources/models/coomer/Animation_Walking_withSkin.glb new file mode 100644 index 0000000..798ef3c Binary files /dev/null and b/resources/models/coomer/Animation_Walking_withSkin.glb differ diff --git a/resources/models/coomer/idle_notransy.glb b/resources/models/coomer/idle_notransy.glb new file mode 100644 index 0000000..65176ea Binary files /dev/null and b/resources/models/coomer/idle_notransy.glb differ diff --git a/resources/models/coomer/unsteadywalk_notransy.glb b/resources/models/coomer/unsteadywalk_notransy.glb new file mode 100644 index 0000000..98c2734 Binary files /dev/null and b/resources/models/coomer/unsteadywalk_notransy.glb differ diff --git a/resources/models/coomerAnim.zip b/resources/models/coomerAnim.zip new file mode 100644 index 0000000..d833ad3 Binary files /dev/null and b/resources/models/coomerAnim.zip differ diff --git a/types/types.go b/types/types.go index c747b59..49aa718 100644 --- a/types/types.go +++ b/types/types.go @@ -49,6 +49,7 @@ type ModelAsset struct { Animation []rl.ModelAnimation // Keep this for compatibility AnimFrames int32 // Keep this for compatibility Animations AnimationSet // New field for organized animations + YOffset float32 // Additional height offset (added to default 8.0) } type ChatMessage struct {