- Joined
- Mar 17, 2008
- Messages
- 179
- Reaction score
- 116
- Points
- 43
- Location
- Southwest Pennsylginia
- Website
- sites.google.com
I have rotation animations on the third stage and payload of a multistage vehicle.
Everything's fine until the jettisoned payload starts to rotate. It stutters for a second, rotates the wrong way for a few seconds, then changes direction and works normally.
Maybe an animation expert can help me out.
I hope this makes sense.
Everything's fine until the jettisoned payload starts to rotate. It stutters for a second, rotates the wrong way for a few seconds, then changes direction and works normally.
Maybe an animation expert can help me out.
I hope this makes sense.
Code:
trans_Third = { -- transformation for third stage animation
type = "rotation", -- transformation type
mesh = 0, -- mesh index
grp = 0, -- groups
ref = {x=0,y=0,z=0}, -- reference point
axis = {x=0,y=0,z=-1}, -- rotation axis
angle = 360*RAD -- rotation angle
}
trans_Sat1 = { -- transformation for satellite animation
type = "rotation", -- transformation type
mesh = 0, -- mesh index
grp = 1, -- groups
ref = {x=0,y=0,z=0}, -- reference point
axis = {x=0,y=0,z=-1}, -- rotation axis
angle = 360*RAD -- rotation angle
}
trans_Sat2 = { -- transformation for jettisoned satellite animation
type = "rotation", -- transformation type
mesh = 0, -- mesh index
grp = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}, -- groups
ref = {x=0,y=0,z=0}, -- reference point
axis = {x=0,y=0,z=-1}, -- rotation axis
angle = 360*RAD -- rotation angle
}
-- Spin the third stage and satellite assembly
function third_spin()
animcomp_Third = oapi.create_animationcomponent(trans_Third)
anim_Third = vi:create_animation(0)
vi:add_animationcomponent(anim_Third,0,1,animcomp_Third)
animcomp_Sat1 = oapi.create_animationcomponent(trans_Sat1)
anim_Sat1 = vi:create_animation(0)
vi:add_animationcomponent(anim_Sat1,0,1,animcomp_Sat1)
local rot1 = vi:get_animation(anim_Third)
local rot2 = vi:get_animation(anim_Sat1)
local third_proc = rot1 + da
local sat1_proc = rot2 + da
if rot1 < 1 then
vi:set_animation (anim_Third, third_proc)
end
if arm_config == 1 then
if rot2 < 1 then
vi:set_animation (anim_Sat1, sat1_proc)
end
end
end
-- Spin the jettisoned satellite
function sat_spin()
animcomp_Sat2 = oapi.create_animationcomponent(trans_Sat2)
anim_Sat2 = vi:create_animation(0)
vi:add_animationcomponent(anim_Sat2,0,1,animcomp_Sat2)
local rot3 = vi:get_animation(anim_Sat2)
local sat2_proc = rot3 + da2
if rot3 < 1 then
vi:set_animation (anim_Sat2, sat2_proc)
end
end
function clbk_poststep(simt,simdt,mjd)
da = (simdt * 0.5)
da2 = (simdt * 0.3)
if config == 2 then
third_spin()
elseif config == 3 then
sat_spin()
end
end