Add skinning
This commit is contained in:
@@ -3,14 +3,44 @@ test_object = inherit_table(game_object)
|
||||
|
||||
function test_object:on_init()
|
||||
game_object.on_init(self)
|
||||
|
||||
self:load_model("data/models/weapons/v_ump.iqm")
|
||||
|
||||
self.m_test_id = self:find_animation("idle1")
|
||||
console.print(string.format("test_object:on_init: self.m_test_id = %d", self.m_test_id))
|
||||
|
||||
|
||||
self:load_model("data/models/scene_walls.obj")
|
||||
|
||||
self.m_test = 0.0
|
||||
self:play_animation(self.m_test_id, ANIM_PLAYBACK_REPEAT)
|
||||
|
||||
-- self.m_test = 0.0
|
||||
end
|
||||
|
||||
function test_object:on_update(dt)
|
||||
game_object.on_update(self, dt)
|
||||
self:set_position(self.m_test, 0.0, 0.0)
|
||||
self.m_test = self.m_test + ( 0.2 * dt )
|
||||
end
|
||||
-- self:set_position(self.m_test, 2.0, 0.0)
|
||||
-- self.m_test = self.m_test + ( 0.2 * dt )
|
||||
end
|
||||
|
||||
function test_object:set_relative_position_to_camera( ent )
|
||||
local camX, camY, camZ = camera.get_position()
|
||||
local frontX, frontY, frontZ = camera.get_front()
|
||||
local rightX, rightY, rightZ = camera.get_right()
|
||||
local upX, upY, upZ = camera.get_up()
|
||||
|
||||
local yaw = camera.get_yaw()
|
||||
local pitch = camera.get_pitch()
|
||||
|
||||
self:set_rotation(pitch, -yaw, 0.0)
|
||||
|
||||
local offsetx = 0.0
|
||||
local offsety = 0.0
|
||||
local offsetz = 0.0
|
||||
|
||||
local x = camX + (rightX * offsetx) + (upX * offsety) + (frontX * offsetz)
|
||||
local y = camY + (rightY * offsetx) + (upY * offsety) + (frontY * offsetz)
|
||||
local z = camZ + (rightZ * offsetx) + (upZ * offsety) + (frontZ * offsetz)
|
||||
self:set_position(x, y, z)
|
||||
|
||||
-- force update transform
|
||||
self:update_transform()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user