Far better unfake animation that looks like not shit (if I have to touch the unfake anim code again I'm killing myself)
This commit is contained in:
parent
23fb275fdb
commit
e8112ffd8a
2 changed files with 34 additions and 32 deletions
|
|
@ -32,14 +32,14 @@ It is, however, not compatbile with:
|
||||||
|
|
||||||
## Todo list
|
## Todo list
|
||||||
|
|
||||||
Urgent shit:
|
MUST BE DONE BEFORE RELEASE:
|
||||||
|
|
||||||
- Look into improving the unfake animation? Really scared to try and touch it again but it would be worthwhile
|
- NPCs should not unfake when moved around
|
||||||
|
- Actual specific reactions to being on fire / falling / lots of pain
|
||||||
|
|
||||||
Stuff to do:
|
Stuff to do:
|
||||||
|
|
||||||
- Facial expressions
|
- Facial expressions
|
||||||
- Actual specific reactions to being on fire / falling / lots of pain
|
|
||||||
- Generally improve stumbling (foot stepping)
|
- Generally improve stumbling (foot stepping)
|
||||||
|
|
||||||
Post release ideas:
|
Post release ideas:
|
||||||
|
|
|
||||||
|
|
@ -42,20 +42,20 @@ local twitchable_bone_names = {
|
||||||
|
|
||||||
local fakeup_bone_names = {
|
local fakeup_bone_names = {
|
||||||
"ValveBiped.Bip01_Pelvis",
|
"ValveBiped.Bip01_Pelvis",
|
||||||
--[[]"ValveBiped.Bip01_Spine2",]]
|
"ValveBiped.Bip01_Spine2",
|
||||||
"ValveBiped.Bip01_Head1",
|
"ValveBiped.Bip01_Head1",
|
||||||
--[[]"ValveBiped.Bip01_R_Thigh",
|
"ValveBiped.Bip01_R_Thigh",
|
||||||
"ValveBiped.Bip01_L_Thigh",
|
"ValveBiped.Bip01_L_Thigh",
|
||||||
"ValveBiped.Bip01_L_Calf",
|
"ValveBiped.Bip01_L_Calf",
|
||||||
"ValveBiped.Bip01_R_Calf",
|
"ValveBiped.Bip01_R_Calf",
|
||||||
"ValveBiped.Bip01_R_Foot",
|
"ValveBiped.Bip01_R_Foot",
|
||||||
"ValveBiped.Bip01_L_Foot",
|
"ValveBiped.Bip01_L_Foot",
|
||||||
--[["ValveBiped.Bip01_R_Upperarm",
|
"ValveBiped.Bip01_R_Upperarm",
|
||||||
--[["ValveBiped.Bip01_L_Upperarm",
|
"ValveBiped.Bip01_L_Upperarm",
|
||||||
"ValveBiped.Bip01_R_Forearm",
|
"ValveBiped.Bip01_R_Forearm",
|
||||||
"ValveBiped.Bip01_L_Forearm",
|
"ValveBiped.Bip01_L_Forearm",
|
||||||
"ValveBiped.Bip01_R_Hand",
|
"ValveBiped.Bip01_R_Hand",
|
||||||
"ValveBiped.Bip01_L_Hand",]]
|
"ValveBiped.Bip01_L_Hand",
|
||||||
}
|
}
|
||||||
|
|
||||||
local fakeup_bone_down_names = {
|
local fakeup_bone_down_names = {
|
||||||
|
|
@ -237,7 +237,15 @@ function MODULE:Think()
|
||||||
local parent = self.FakeParent
|
local parent = self.FakeParent
|
||||||
if !IsValid(parent) then return end
|
if !IsValid(parent) then return end
|
||||||
|
|
||||||
--parent:FrameAdvance(FrameTime())
|
if !self.ModelBoneList then return end
|
||||||
|
|
||||||
|
--[[for i,v in pairs(self.ModelBoneList) do
|
||||||
|
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(v)))
|
||||||
|
|
||||||
|
if !IsValid(object) then continue end
|
||||||
|
|
||||||
|
object:EnableCollisions(false)
|
||||||
|
end]]
|
||||||
end
|
end
|
||||||
|
|
||||||
if !IsValid(phys) or !phys:IsAsleep() then return end
|
if !IsValid(phys) or !phys:IsAsleep() then return end
|
||||||
|
|
@ -304,28 +312,23 @@ function MODULE:PhysicsSimulate(phys, dt)
|
||||||
local i = 0
|
local i = 0
|
||||||
|
|
||||||
while i < target:GetBoneCount() do
|
while i < target:GetBoneCount() do
|
||||||
table.insert(self.ModelBoneList, target:GetBoneName(i))
|
local name = target:GetBoneName(i)
|
||||||
|
local object = target:LookupBone(name)
|
||||||
|
|
||||||
|
if object == -1 then i = i + 1; continue end
|
||||||
|
|
||||||
|
self.ModelBoneList[name] = target:GetBoneMatrix(object)
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local animation_progress = (CurTime() - self.FakeUpStart) / (self.FakeUpEnd - self.FakeUpStart)
|
local animation_progress = (CurTime() - self.FakeUpStart) / (self.FakeUpEnd - self.FakeUpStart)
|
||||||
|
|
||||||
--[[util.TraceLine({
|
for i, name in pairs(fakeup_bone_names) do
|
||||||
start = parent:GetPos() + Vector(0, 128, 0),
|
print(name)
|
||||||
endpos = parent:GetPos(),
|
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(name)))
|
||||||
collisiongroup = COLLISION_GROUP_NPC
|
local parent_bone = parent:LookupBone(name)
|
||||||
})]]
|
|
||||||
|
|
||||||
for i,v in pairs(fakeup_bone_down_names) do
|
|
||||||
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(v)))
|
|
||||||
|
|
||||||
object:SetMass(0.5)
|
|
||||||
end
|
|
||||||
|
|
||||||
for i,v in pairs(fakeup_bone_names) do
|
|
||||||
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(v)))
|
|
||||||
local parent_bone = parent:LookupBone(v)
|
|
||||||
|
|
||||||
if parent_bone == -1 then continue end
|
if parent_bone == -1 then continue end
|
||||||
|
|
||||||
|
|
@ -333,12 +336,13 @@ function MODULE:PhysicsSimulate(phys, dt)
|
||||||
if !parent_bone_matrix then continue end
|
if !parent_bone_matrix then continue end
|
||||||
|
|
||||||
local parent_bone_pos, parent_bone_angle = parent_bone_matrix:GetTranslation(), parent_bone_matrix:GetAngles()
|
local parent_bone_pos, parent_bone_angle = parent_bone_matrix:GetTranslation(), parent_bone_matrix:GetAngles()
|
||||||
parent_bone_angle.y = parent_bone_angle.y + 90
|
local old_bone_pos, old_bone_angle = object:GetPos(), object:GetAngles()
|
||||||
|
--parent_bone_angle.y = parent_bone_angle.y + 90
|
||||||
|
|
||||||
local shadow_data = {
|
local shadow_data = {
|
||||||
secondstoarrive = 0.01,
|
secondstoarrive = 0.01,
|
||||||
pos = LerpVector(animation_progress, object:GetPos(), parent_bone_pos),
|
pos = LerpVector(animation_progress, old_bone_pos, parent_bone_pos),
|
||||||
angle = LerpAngle(animation_progress, object:GetAngles(), parent_bone_angle),
|
angle = LerpAngle(animation_progress, old_bone_angle, parent_bone_angle),
|
||||||
maxspeed = 400,
|
maxspeed = 400,
|
||||||
maxangular = 2000,
|
maxangular = 2000,
|
||||||
maxspeeddamp = 60,
|
maxspeeddamp = 60,
|
||||||
|
|
@ -348,12 +352,10 @@ function MODULE:PhysicsSimulate(phys, dt)
|
||||||
-- Can't set position inside physics tick, crashes the game instantly.
|
-- Can't set position inside physics tick, crashes the game instantly.
|
||||||
-- Instead, send a shadow for it to follow (I think? I don't know GMod is kinda funky)
|
-- Instead, send a shadow for it to follow (I think? I don't know GMod is kinda funky)
|
||||||
object:ComputeShadowControl(shadow_data)
|
object:ComputeShadowControl(shadow_data)
|
||||||
|
|
||||||
object:Wake()
|
|
||||||
object:EnableGravity(false)
|
|
||||||
object:Wake()
|
object:Wake()
|
||||||
|
|
||||||
i = i + 1
|
--i = i + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue