I'm trying to do a new door, without real animation, and do a fake animation because of the firearms shots that are blocked around the real beach_master_gate.
Code: Select all
defineObject{
name = "beach_master_gate_new",
baseObject = "base_wall_decoration",
components = {
{
class = "Model",
model = "mod_assets/models/beach_master_gate_frame.fbx",
rotation = vec(0, 180, 0),
staticShadow = true,
},
{
class = "Model",
name = "door1",
model = "mod_assets/models/beach_master_gate_left_door.fbx",
offset = vec(1.5, 0, 0),
staticShadow = true,
},
{
class = "Model",
name = "door2",
model = "mod_assets/models/beach_master_gate_right_door.fbx",
offset = vec(-1.5, 0, 0),
staticShadow = true,
},
{
class = "Timer",
enabled = false,
currentLevelOnly = true,
timerInterval = 0,
-- DisableSelf = true,
onActivate = function(self)
local time = Time.currentTime()*128
self.go.door1:setRotationAngles(0, time%360, 0)
self.go.door1:setRotationAngles(0, time*1.4%360, 0)
end,
},
{
class = "Timer",
enabled = false,
name = "timer2",
currentLevelOnly = true,
timerInterval = 0,
-- DisableSelf = true,
onActivate = function(self)
local time = Time.currentTime()*128
self.go.door2:setRotationAngles(0, -time%360, 0)
self.go.door2:setRotationAngles(0, -time*1.4%360, 0)
end,
},
{
class = "Controller",
onInitialActivate = function(self)
self.go.timer:enable()
self.go.timer2:enable()
-- playSound("master_gate_open")
end,
onInitialDeactivate = function(self)
self.go.timer:disable()
self.go.timer2:disable()
end,
onActivate = function(self)
self.go.timer:enable()
self.go.timer2:enable()
playSound("master_gate_open")
end,
onDeactivate = function(self)
self.go.timer:disable()
self.go.timer2:disable()
end,
onToggle = function(self)
self.go.timer:disable()
self.go.timer2:disable()
end,
},
},
editorIcon = 92,
-- minimalSaveState = true,
}
Problem is in this way, the fake door acts not nicely. I don't know how to work that formula with time and angle rotation.
The fake doors has to rotate 90° on z axis, in max 3 seconds (time for playing the master gate opening sound)
I have taken that formula from minmay's asset megapack (used for the prison walls).