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
|
||||
|
||||
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:
|
||||
|
||||
- Facial expressions
|
||||
- Actual specific reactions to being on fire / falling / lots of pain
|
||||
- Generally improve stumbling (foot stepping)
|
||||
|
||||
Post release ideas:
|
||||
|
|
|
|||
|
|
@ -42,20 +42,20 @@ local twitchable_bone_names = {
|
|||
|
||||
local fakeup_bone_names = {
|
||||
"ValveBiped.Bip01_Pelvis",
|
||||
--[[]"ValveBiped.Bip01_Spine2",]]
|
||||
"ValveBiped.Bip01_Spine2",
|
||||
"ValveBiped.Bip01_Head1",
|
||||
--[[]"ValveBiped.Bip01_R_Thigh",
|
||||
"ValveBiped.Bip01_R_Thigh",
|
||||
"ValveBiped.Bip01_L_Thigh",
|
||||
"ValveBiped.Bip01_L_Calf",
|
||||
"ValveBiped.Bip01_R_Calf",
|
||||
"ValveBiped.Bip01_R_Foot",
|
||||
"ValveBiped.Bip01_L_Foot",
|
||||
--[["ValveBiped.Bip01_R_Upperarm",
|
||||
--[["ValveBiped.Bip01_L_Upperarm",
|
||||
"ValveBiped.Bip01_R_Upperarm",
|
||||
"ValveBiped.Bip01_L_Upperarm",
|
||||
"ValveBiped.Bip01_R_Forearm",
|
||||
"ValveBiped.Bip01_L_Forearm",
|
||||
"ValveBiped.Bip01_R_Hand",
|
||||
"ValveBiped.Bip01_L_Hand",]]
|
||||
"ValveBiped.Bip01_L_Hand",
|
||||
}
|
||||
|
||||
local fakeup_bone_down_names = {
|
||||
|
|
@ -237,7 +237,15 @@ function MODULE:Think()
|
|||
local parent = self.FakeParent
|
||||
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
|
||||
|
||||
if !IsValid(phys) or !phys:IsAsleep() then return end
|
||||
|
|
@ -304,28 +312,23 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
local i = 0
|
||||
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
local animation_progress = (CurTime() - self.FakeUpStart) / (self.FakeUpEnd - self.FakeUpStart)
|
||||
|
||||
--[[util.TraceLine({
|
||||
start = parent:GetPos() + Vector(0, 128, 0),
|
||||
endpos = parent:GetPos(),
|
||||
collisiongroup = COLLISION_GROUP_NPC
|
||||
})]]
|
||||
|
||||
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)
|
||||
for i, name in pairs(fakeup_bone_names) do
|
||||
print(name)
|
||||
local object = target:GetPhysicsObjectNum(target:TranslateBoneToPhysBone(target:LookupBone(name)))
|
||||
local parent_bone = parent:LookupBone(name)
|
||||
|
||||
if parent_bone == -1 then continue end
|
||||
|
||||
|
|
@ -333,12 +336,13 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
if !parent_bone_matrix then continue end
|
||||
|
||||
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 = {
|
||||
secondstoarrive = 0.01,
|
||||
pos = LerpVector(animation_progress, object:GetPos(), parent_bone_pos),
|
||||
angle = LerpAngle(animation_progress, object:GetAngles(), parent_bone_angle),
|
||||
pos = LerpVector(animation_progress, old_bone_pos, parent_bone_pos),
|
||||
angle = LerpAngle(animation_progress, old_bone_angle, parent_bone_angle),
|
||||
maxspeed = 400,
|
||||
maxangular = 2000,
|
||||
maxspeeddamp = 60,
|
||||
|
|
@ -349,11 +353,9 @@ function MODULE:PhysicsSimulate(phys, dt)
|
|||
-- Instead, send a shadow for it to follow (I think? I don't know GMod is kinda funky)
|
||||
object:ComputeShadowControl(shadow_data)
|
||||
|
||||
object:Wake()
|
||||
object:EnableGravity(false)
|
||||
object:Wake()
|
||||
|
||||
i = i + 1
|
||||
--i = i + 1
|
||||
end
|
||||
|
||||
return false
|
||||
|
|
|
|||
Loading…
Reference in a new issue