Jump to content

VicToMeyeZR

Members
  • Posts

    570
  • Joined

  • Last visited

Everything posted by VicToMeyeZR

  1. lol... oops Hence the reason it crashes. End and start time are both the same.
  2. Can someone give me an idea what I got wrong here. I can put the model in the editor, but as soon as I set the values for the idle animation I get Exception violation, and it crashes. Thanks require("scripts/class") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) group = grid:AddGroup("Animations") group:AddProperty("idle_start", PROPERTY_INTEGER, "Idle Start Frame") group:AddProperty("idle_end", PROPERTY_INTEGER, "Idle End Frame") group:AddProperty("walk_start", PROPERTY_INTEGER, "Walk Start Frame") group:AddProperty("walk_end", PROPERTY_INTEGER, "Walk End Frame") group:AddProperty("run_start", PROPERTY_INTEGER, "Run Start Frame") group:AddProperty("run_end", PROPERTY_INTEGER, "Run End Frame") group:AddProperty("jump_start", PROPERTY_INTEGER, "Jump Start Frame") group:AddProperty("jump_end", PROPERTY_INTEGER, "Jump End Frame") group:AddProperty("crouch_start", PROPERTY_INTEGER, "Crouch Start Frame") group:AddProperty("crouch_start", PROPERTY_INTEGER, "Crouch End Frame") group:AddProperty("strafeleft_begin", PROPERTY_INTEGER, "Left Start Frame") group:AddProperty("strafeleft_end", PROPERTY_INTEGER, "Left End Frame") group:AddProperty("straferight_begin", PROPERTY_INTEGER, "Right Start Frame") group:AddProperty("straferight_end", PROPERTY_INTEGER, "Right End Frame") group:Expand(1) end function class:CreateObject(model) local object = self.super:CreateObject(model) object.model = model object.framestart = tonumber(object:GetKey("idle_start")) object.frameend = tonumber(object:GetKey("idle_end")) Notify(object.framestart) function object:SetKey(key,value) if key=="idle_start" then self.idle_start = tonumber(value) elseif key=="idle_end" then self.idle_end = tonumber(value) elseif key=="walk_start" then self.walk_start = tonumber(value) elseif key=="walk_end" then self.walk_end = tonumber(value) elseif key=="run_start" then self.run_start = tonumber(value) elseif key=="run_end" then self.run_end = tonumber(value) elseif key=="jump_start" then self.jump_start = tonumber(value) elseif key=="jump_end" then self.jump_end = tonumber(value) elseif key=="crouch_start" then self.crouch_start = tonumber(value) elseif key=="crouch_end" then self.crouch_end = tonumber(value) elseif key=="strafeleft_start" then self.strafeleft_start = tonumber(value) elseif key=="strafeleft_end" then self.strafeleft_end = tonumber(value) elseif key=="straferight_start" then self.straferight_start = tonumber(value) elseif key=="straferight_end" then self.straferight_end = tonumber(value) else return self.super:SetKey(key,value) end return 1 end function object:GetKey(key,value) if key=="idle_start" then return self.idle_start elseif key=="idle_end" then return self.idle_start elseif key=="walk_start" then return self.walk_start elseif key=="walk_end" then return self.walk_end elseif key=="run_start" then return self.run_start elseif key=="run_end" then return self.run_end elseif key=="jump_start" then return self.jump_start elseif key=="jump_end" then return self.jump_end elseif key=="crouch_start" then return self.crouch_start elseif key=="crouch_end" then return self.crouch_end elseif key=="strafeleft_start" then return self.strafeleft_start elseif key=="strafeleft_end" then return self.strafeleft_end elseif key=="straferight_start" then return self.straferight_start elseif key=="straferight_end" then return self.straferight_end else return self.super:GetKey(key,value) end return value end function object:StartAnimations(movement) object.framestart = object:GetKey(movement .. "_start") return object.framestart end function object:EndAnimations(movement) object.frameend = object:GetKey(movement .. "_end") return object.frameend end function object:LockKeys(model) self.super:LockKeys() end function object:UnlockKeys(model) self.super:UnlockKeys() end function object:UpdateMatrix() end function object:Reset() end function object:SetTarget(target,index) end function object:Collision(entity,position,normal,force,speed) end function object:ReceiveMessage(message,extra) if message=="forward" then --[[ elseif message=="reverse" then elseif message=="mleft" then elseif message=="mright" then elseif message=="tleft" then elseif message=="tright" then elseif message=="crouch" then elseif message=="jump" then elseif message=="attack" then ]]-- else self.super:ReceiveMessage(message,extra) end end function object:Render() object.framestart = object:StartAnimations("idle") object.frameend = object:EndAnimations("idle") if object.frameend ~= nil and object.frameend ~= 0 or object.framestart ~= nil then object.frame = math.fmod(AppTime()/35, object.framestart - object.frameend) + object.framestart Animate(object.model, object.frame, 0.5, 0, true) end end function object:Free(model) self.super:Free() end end function class:Free() self.super:Free() end
  3. cool.. Sounds good to me.
  4. ok. revised for your next version. require("scripts/class") require("Scripts/hooks") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) group = grid:AddGroup("Character") group:AddProperty("model", PROPERTY_FILE, "GMF Files (*.gmf):gmf", "", "Model Files") group:AddProperty("controller_height", PROPERTY_FLOAT, "Controller Height") group:AddProperty("controller_radius", PROPERTY_FLOAT, "Controller Radius") group:AddProperty("controller_step_height", PROPERTY_FLOAT, "Controller Step Height") group:AddProperty("controller_max_slope", PROPERTY_FLOAT, "Controller Max Slope") group = grid:AddGroup("Animations") group:AddProperty("idle_start", PROPERTY_INTEGER, "Idle Start Frame") group:AddProperty("idle_end", PROPERTY_INTEGER, "Idle End Frame") group:AddProperty("walk_start", PROPERTY_INTEGER, "Walk Start Frame") group:AddProperty("walk_end", PROPERTY_INTEGER, "Walk End Frame") group:AddProperty("run_start", PROPERTY_INTEGER, "Run Start Frame") group:AddProperty("run_end", PROPERTY_INTEGER, "Run End Frame") group:AddProperty("jump_start", PROPERTY_INTEGER, "Jump Start Frame") group:AddProperty("jump_end", PROPERTY_INTEGER, "Jump End Frame") group:AddProperty("crouch_start", PROPERTY_INTEGER, "Crouch Start Frame") group:AddProperty("crouch_start", PROPERTY_INTEGER, "Crouch End Frame") group:Expand(1) end function class:CreateObject(model) local object=self.super:CreateObject(model) object.model = model object.height = tonumber(object:GetKey("controller_height", "1.8")) local radius = tonumber(object:GetKey("controller_radius", "0.4")) local step = tonumber(object:GetKey("controller_step_height", "0.5")) local slope = tonumber(object:GetKey("controller_max_slope", "45.0")) object.oneTime = false object.controller = CreateController(object.height, radius, step, slope) object.controller:SetMass(1.0) EntityType(object.controller, 1) -- set the position of the controller to the editor object local pos = object.model:GetPosition() object.controller:SetPosition(Vec3(pos.x, pos.y + (object.height/2), pos.z)) object.characterModel = nil object.move = 0 object.strafe = 0 object.rotate = 0 object.jump = 0 object.moveSpeed = 2 object.strafeSpeed = 2 object.framestart = 0 object.frameend = 0 function object:StartAnimations(movement) object.framestart = self.model:GetKey(movement .. "_start") return object.framestart end function object:EndAnimations(movement) object.frameend = self.model:GetKey(movement .. "_end") return object.frameend end function object:SetKey(key,value) if key=="model" then local pos = self.model:GetPosition() self.characterModel = LoadModel("abstract::"..value) self.characterModel:SetPosition(Vec3(pos.x, pos.y, pos.z)) else return self.super:SetKey(key,value) end return 1 end function object:GetKey(key,value) if key=="" then else return self.super:GetKey(key,value) end return value end function object:Update() if object.move == 0 then if object.frameend ~= 0 then object:StartAnimations("idle") object:EndAnimations("idle") else object.framestart = 0 object.frameend = 100 end end if self.characterModel ~= nil then if object.frameend ~= 0 then object.frame = math.fmod(AppTime()/35, object.frameend-object.framestart)+object.framestart Animate(self.characterModel, object.frame, 1.0, 0, true) end end if GetGlobalString("mode") == "GAME_MODE" then if self.characterModel ~= nil then if object.oneTime == false then object.oneTime = true object.controller:SetPosition(object.model:GetPosition()) end self.controller:Update(self.rotation, self.move, self.strafe, self.jump, 5000, 10) self.jump = 0 -- reset -- the character model must follow the controller -- for the 3rd person camera to work we must also move the object model, which is stupid self.model:SetPosition(Vec3(object.controller.position.x, object.controller.position.y - (object.height/2), object.controller.position.z)) self.characterModel:SetPosition(Vec3(object.controller.position.x, object.controller.position.y - (object.height/2), object.controller.position.z)) end else -- constantly update the controller to the object in the editor local pos = object.model:GetPosition() object.controller:SetPosition(Vec3(pos.x, pos.y + (object.height/2), pos.z)) -- make the model follow if self.characterModel ~= nil then self.characterModel:SetPosition(Vec3(pos.x, pos.y, pos.z)) end end end function object:UpdateMatrix() end --[[ function object:LockKeys(model) self.super:LockKeys() end ]]-- --[[ function object:UnlockKeys(model) self.super:UnlockKeys() end ]]-- --[[ function object:UpdateMatrix() end ]]-- --[[ function object:Reset() end ]]-- --[[ function object:SetTarget(target,index) end ]]-- --[[ function object:Collision(entity,position,normasl,force,speed) end ]]-- function object:ReceiveMessage(message,extra) if message == "move" then object.move = tonumber(extra) * self.moveSpeed object:StartAnimations("walk") object:EndAnimations("walk") elseif message == "jump" and object.controller:IsAirborne() == 0 then object.jump = tonumber(extra) elseif message == "strafe" then object.strafe = tonumber(extra) * self.strafeSpeed else self.super:ReceiveMessage(message,extra) end end function object:Free(model) object.controller:Free() if object.characterModel ~= nil then object.characterModel:Free() end --Notify("Inside free") self.super:Free() end end --[[ function class:Free() self.super:Free() end ]]-- Checked Animations per movement, and they do work. BUG: Animation frames for idle, MUST be set prior to loading the character mesh.
  5. I haven't tested that part yet... I am trying to debug it so it won't crash all the time, so it means adding alot of if then checks, because if the start frame and end frame ever end up both being 0, it will crash the editor
  6. Hey. Rick, I thought I would help a little with this. require("scripts/class") require("Scripts/hooks") local class=CreateClass(...) function class:InitDialog(grid) self.super:InitDialog(grid) group = grid:AddGroup("Character") group:AddProperty("model", PROPERTY_FILE, "GMF Files (*.gmf):gmf", "", "Model Files") group:AddProperty("controller_height", PROPERTY_FLOAT, "Controller Height") group:AddProperty("controller_radius", PROPERTY_FLOAT, "Controller Radius") group:AddProperty("controller_step_height", PROPERTY_FLOAT, "Controller Step Height") group:AddProperty("controller_max_slope", PROPERTY_FLOAT, "Controller Max Slope") group = grid:AddGroup("Animations") group:AddProperty("idle_start", PROPERTY_INTEGER, "Idle Start Frame") group:AddProperty("idle_end", PROPERTY_INTEGER, "Idle End Frame") group:AddProperty("walk_start", PROPERTY_INTEGER, "Walk Start Frame") group:AddProperty("walk_end", PROPERTY_INTEGER, "Walk End Frame") group:AddProperty("run_start", PROPERTY_INTEGER, "Run Start Frame") group:AddProperty("run_end", PROPERTY_INTEGER, "Run End Frame") group:AddProperty("jump_start", PROPERTY_INTEGER, "Jump Start Frame") group:AddProperty("jump_end", PROPERTY_INTEGER, "Jump End Frame") group:AddProperty("crouch_start", PROPERTY_INTEGER, "Crouch Start Frame") group:AddProperty("crouch_start", PROPERTY_INTEGER, "Crouch End Frame") group:Expand(1) end function class:CreateObject(model) local object=self.super:CreateObject(model) object.model = model object.height = tonumber(object:GetKey("controller_height", "1.8")) local radius = tonumber(object:GetKey("controller_radius", "0.4")) local step = tonumber(object:GetKey("controller_step_height", "0.5")) local slope = tonumber(object:GetKey("controller_max_slope", "45.0")) object.oneTime = false object.controller = CreateController(object.height, radius, step, slope) object.controller:SetMass(1.0) EntityType(object.controller, 1) -- set the position of the controller to the editor object local pos = object.model:GetPosition() object.controller:SetPosition(Vec3(pos.x, pos.y + (object.height/2), pos.z)) object.characterModel = nil object.move = 0 object.strafe = 0 object.rotate = 0 object.jump = 0 object.moveSpeed = 2 object.strafeSpeed = 2 object.framestart = 0 object.frameend = 0 function object:StartAnimations(movement) object.framestart = self.model:GetKey(movement .. "_start") return object.framestart end function object:EndAnimations(movement) object.frameend = self.model:GetKey(movement .. "_end") return object.frameend end function object:SetKey(key,value) if key=="model" then local pos = self.model:GetPosition() self.characterModel = LoadModel("abstract::"..value) self.characterModel:SetPosition(Vec3(pos.x, pos.y, pos.z)) else return self.super:SetKey(key,value) end return 1 end function object:GetKey(key,value) if key=="" then else return self.super:GetKey(key,value) end return value end function object:Update() if object.frameend ~= 0 then object:StartAnimations("idle") object:EndAnimations("idle") else object.framestart = 0 object.frameend = 100 end if self.characterModel ~= nil then if object.frameend ~= 0 then object.frame = math.fmod(AppTime()/35, object.frameend-object.framestart)+object.framestart Animate(self.characterModel, object.frame, 1.0, 0, true) end end if GetGlobalString("mode") == "GAME_MODE" then if self.characterModel ~= nil then if object.oneTime == false then object.oneTime = true object.controller:SetPosition(object.model:GetPosition()) end self.controller:Update(self.rotation, self.move, self.strafe, self.jump, 5000, 10) self.jump = 0 -- reset -- the character model must follow the controller -- for the 3rd person camera to work we must also move the object model, which is stupid self.model:SetPosition(Vec3(object.controller.position.x, object.controller.position.y - (object.height/2), object.controller.position.z)) self.characterModel:SetPosition(Vec3(object.controller.position.x, object.controller.position.y - (object.height/2), object.controller.position.z)) end else -- constantly update the controller to the object in the editor local pos = object.model:GetPosition() object.controller:SetPosition(Vec3(pos.x, pos.y + (object.height/2), pos.z)) -- make the model follow if self.characterModel ~= nil then self.characterModel:SetPosition(Vec3(pos.x, pos.y, pos.z)) end end end function object:UpdateMatrix() end --[[ function object:LockKeys(model) self.super:LockKeys() end ]]-- --[[ function object:UnlockKeys(model) self.super:UnlockKeys() end ]]-- --[[ function object:UpdateMatrix() end ]]-- --[[ function object:Reset() end ]]-- --[[ function object:SetTarget(target,index) end ]]-- --[[ function object:Collision(entity,position,normasl,force,speed) end ]]-- function object:ReceiveMessage(message,extra) if message == "move" then object.move = tonumber(extra) * self.moveSpeed object:GetAnimations("walk") elseif message == "jump" and object.controller:IsAirborne() == 0 then object.jump = tonumber(extra) object:GetAnimations("jump") elseif message == "strafe" then object.strafe = tonumber(extra) * self.strafeSpeed else self.super:ReceiveMessage(message,extra) end end function object:Free(model) object.controller:Free() if object.characterModel ~= nil then object.characterModel:Free() end --Notify("Inside free") self.super:Free() end end --[[ function class:Free() self.super:Free() end ]]-- What this does so far; Add's the fields in the property to add the animation frames for input. Debugs to check if inputs are 0, will not crash "Unhandled Exception" Deafults to idle frames. Needed: Way to check what the message recieved from key board controller for movement animation Let me know what you think
  7. that one is much easier than the lua site. thanks also.. I call group:AddProperty("idle_start", PROPERTY_INTEGER, "", "Idle Start Frame") but when I try to reference that value, it always pulls the default value only? object.framestart = object:GetKey("idle_start", "450") Is this not the right syntax?
  8. @Rick.. Using your character thingoid if you assign the character to it, would the character lua code, then become the child of the character controller? I am wondering, because the animation sequences would be in the update() part of the character script, but trying to find the way to assign when key pressed play this sequence..
  9. frame = math.fmod(AppTime()/35,frameend-framestart)+framestart it was math.fmod that I wanted. Thanks for your help
  10. whats the lua for the fmodf function in c++?
  11. If you use the project wizard there is a resource file.. IDI_ICON1 ICON "le_test.ico" You should be able to change that... I haven't tried yet
  12. I noticed when I first ran it, the particles were off to the right, and I had to click the move right button 5-6 times to get the particles on screen.... I also use ATI, so it shouldn't be that.
  13. what if you put the : Flip(0) inside your if statement?
  14. hmm.. Well hopefully someone will post a few hints as to how to call the animation sequences in Lua..
  15. So as long as you know the frame range for each animation, you can assign each animation to what ever you want then?
  16. Anyone have an example of the lua script for the animation of the models. Also, does the wiki have the bone names and requirements listed anywhere? I can't seem to find it.
  17. yup. The mipmaps must have been the problem. Thank you.
  18. very nice.. Keep it up, looking very promising.
  19. I haven't checked. The DDS are straight from dexsoft. Edit: doesn't appear they are.
  20. ok. Leadwerks Engine 2.3 Initializing Renderer... OpenGL Version: 2.1.8787 GLSL Version: 1.30 Render device: ATI Radeon HD 4800 Series Vendor: ATI Technologies Inc. DrawBuffers2 supported: 1 16 texture units supported. GPU instancing supported: 1 Max batch size: 1024 Shader model 4.0 supported: 1 Conditional render supported: 0 Loading shader "zip::c:/tools/leadwerks engine sdk/shaders.pak//query.vert", ""... Invoking script "C:/Tools/Leadwerks Engine SDK/Scripts/start/collisions.lua"... Invoking script "C:/Tools/Leadwerks Engine SDK/Scripts/start/globals.lua"... Loading shader "zip::c:/tools/leadwerks engine sdk/shaders.pak//postfilters/postfilter.vert", "zip::c:/tools/leadwerks engine sdk/shaders.pak//postfilters/depthblit.frag"... Loading texture "incbin::noise.dds"... Loading shader "zip::c:/tools/leadwerks engine sdk/shaders.pak//postfilters/postfilter.vert", "zip::c:/tools/leadwerks engine sdk/shaders.pak//lighting/directionallight.frag"... Loading mesh "c:/tools/leadwerks engine sdk/models/characters/cyber/character_visor_full.gmf"... Loading material "c:/tools/leadwerks engine sdk/models/characters/cyber/sword_col.mat"... Loading texture "c:/tools/leadwerks engine sdk/models/characters/cyber/sword_col.dds"... Loading shader "zip::c:/tools/leadwerks engine sdk/shaders.pak//mesh/mesh_diffuse_bumpmap_skin.vert", "zip::c:/tools/leadwerks engine sdk/shaders.pak//mesh/mesh_diffuse.frag"... Loading shader "zip::c:/tools/leadwerks engine sdk/shaders.pak//mesh/mesh_shadow_skin.vert", ""... Loading material "c:/tools/leadwerks engine sdk/models/characters/cyber/visor_col.mat"... Loading texture "c:/tools/leadwerks engine sdk/models/characters/cyber/visor_col.dds"... Loading material "c:/tools/leadwerks engine sdk/models/characters/cyber/gun_col.mat"... Loading texture "c:/tools/leadwerks engine sdk/models/characters/cyber/gun_col.dds"... Loading material "c:/tools/leadwerks engine sdk/models/characters/cyber/cyber_col.mat"... Loading texture "c:/tools/leadwerks engine sdk/models/characters/cyber/cyber_col.dds"... Mesh loaded in 131 milliseconds. Loading shader "zip::c:/tools/leadwerks engine sdk/shaders.pak//guide.vert", "zip::c:/tools/leadwerks engine sdk/shaders.pak//editor/guide.frag"... still black in the ModelViewer.
  21. I have yet to be able to get any of the 100's of models I have to render in the editor or game with the textures or materials. I have a character, exported from Fragmotion, opened into UU3D and saved in GMF. I converted the DDS to MAT files. I made sure the file locations were saved as relative to the mesh, and both MAT and DDS files are in the same directory, but all my models are still black. Here is the log from the Model Viewer Leadwerks Engine 2.3 Initializing Renderer... OpenGL Version: 2.1.7169 Release GLSL Version: 1.20 Render device: ATI Mobility Radeon X1300 (Omega 3.8.442) Vendor: ATI Technologies Inc. DrawBuffers2 supported: 0 16 texture units supported. GPU instancing supported: 0 Shader model 4.0 supported: 0 Conditional render supported: 0 Loading shader "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//query.vert", ""... Invoking script "C:/Leadwerks Engine SDK/Scripts/start/collisions.lua"... Invoking script "C:/Leadwerks Engine SDK/Scripts/start/globals.lua"... Loading shader "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//postfilters/postfilter.vert", "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//postfilters/depthblit.frag"... Loading texture "incbin::noise.dds"... Loading shader "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//postfilters/postfilter.vert", "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//lighting/directionallight.frag"... Loading mesh "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/character_visor_full.gmf"... Loading material "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/sword_col.mat"... Loading texture "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/sword_col.dds"... Loading shader "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//mesh/mesh_diffuse.vert", "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//mesh/mesh_diffuse.frag"... Loading material "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/visor_col.mat"... Loading texture "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/visor_col.dds"... Loading material "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/gun_col.mat"... Loading texture "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/gun_col.dds"... Loading material "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/cyber_col.mat"... Loading texture "c:/documents and settings/hx11433/my documents/cyber infiltrator - final/mesh/gmf/cyber_col.dds"... Mesh loaded in 998 milliseconds. Loading shader "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//mesh/mesh_shadow.vert", ""... Loading shader "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//guide.vert", "zip::c:/leadwerks engine sdk/test_chat/shaders.pak//editor/guide.frag"...
  22. werks perfectly fer me. Well done.
×
×
  • Create New...