Bugfix : wave text animation

This commit is contained in:
Philippe Roy 2022-04-24 04:36:43 +02:00
parent ce25cd95ec
commit c1fa2b9aba
2 changed files with 9 additions and 39 deletions

20
ct.py
View File

@ -158,21 +158,16 @@ def points_maj (cont):
# Texte de la vague
if scene.objects['Map_text']['anim']:
if scene.objects['Map_text']['timer']<120:
scene.objects['Map_text'].worldPosition.x += scene.objects['Map_text']['position_delta'][0]
scene.objects['Map_text'].worldPosition.y += scene.objects['Map_text']['position_delta'][1]
scene.objects['Map_text'].worldPosition.z += scene.objects['Map_text']['position_delta'][2]
# scene.objects['Map_text'].worldPosition.x = scene.objects['Map_text']['position_init'][0]+(scene.objects['Map_text']['position_end'][0]-scene.objects['Map_text']['position_init'][0])*(scene.objects['Map_text']['timer']/120)
# scene.objects['Map_text'].worldPosition.y = scene.objects['Map_text']['position_init'][1]+(scene.objects['Map_text']['position_end'][1]-scene.objects['Map_text']['position_init'][1])*(scene.objects['Map_text']['timer']/120)
# scene.objects['Map_text'].worldPosition.z = scene.objects['Map_text']['position_init'][2]+(scene.objects['Map_text']['position_end'][2]-scene.objects['Map_text']['position_init'][2])*(scene.objects['Map_text']['timer']/120)
print (scene.objects['Map_text']['position_init'])
print (scene.objects['Map_text']['timer'])
decal = 0.1
vect=scene.objects['Map_text'].getVectTo(scene.objects['Camera'])[1]
scene.objects['Map_text'].applyMovement((vect[0]*decal, vect[1]*decal, vect[2]*decal), False)
scene.objects['Map_text']['timer']+=1
if int(scene.objects['Map_text']['timer'])>=120:
scene.objects['Map_text'].color = color_text
scene.objects['Map_text'].worldPosition= scene.objects['Map_text']['position_init']
scene.objects['Map_text'].worldPosition.x= scene.objects['Points'].worldPosition.x+ scene.objects['Map_text']['init_relativ_lx']
scene.objects['Map_text'].worldPosition.y= scene.objects['Points'].worldPosition.y+ scene.objects['Map_text']['init_relativ_ly']
scene.objects['Map_text'].worldPosition.z= scene.objects['Points'].worldPosition.z+ scene.objects['Map_text']['init_relativ_lz']
scene.objects['Map_text']['anim']=False
print (scene.objects['Map_text']['position_init'])
print (scene.objects['Map_text']['timer'])
# Gestion du FPS - Tous les tics
if scene.objects['Commands']['debug_fps']:
@ -831,6 +826,9 @@ def manip_init(cont):
scene.objects['Points']['init_lx']=scene.objects['Points'].worldPosition.x
scene.objects['Points']['init_ly']=scene.objects['Points'].worldPosition.y
scene.objects['Points']['init_lz']=scene.objects['Points'].worldPosition.z
scene.objects['Map_text']['init_relativ_lx']=scene.objects['Map_text'].worldPosition.x-scene.objects['Points'].worldPosition.x
scene.objects['Map_text']['init_relativ_ly']=scene.objects['Map_text'].worldPosition.y-scene.objects['Points'].worldPosition.y
scene.objects['Map_text']['init_relativ_lz']=scene.objects['Map_text'].worldPosition.z-scene.objects['Points'].worldPosition.z
# Atteindre une orientation (bas niveau)
def applyRotationTo(obj, rx=None, ry=None, rz=None, Local=True):

View File

@ -495,36 +495,8 @@ def ct_map_text_wave(wave):
scene.objects['Map_text'].setVisible(True,False)
scene.objects['Map_text'].color = color_text_yellow
scene.objects['Map_text']['timer']=0
# scene.objects['Map_text']['position_init']=[8.37716, -2.39401, 5.56759]
# scene.objects['Map_text']['position_end']=[11.1751, 5.99318, 0.480557]
scene.objects['Map_text']['position_init']=[0,0,0]
scene.objects['Map_text']['position_init'][0]=scene.objects['Points'].worldPosition.x+(11.1751-11.5819)
scene.objects['Map_text']['position_init'][1]=scene.objects['Points'].worldPosition.y+(5.99318-7.25838)
scene.objects['Map_text']['position_init'][2]=scene.objects['Points'].worldPosition.z+(0.480557-1.23784)
scene.objects['Map_text']['position_delta']=[-2.79794/120, -8.38719/120, 5.087033/120]
# 11.5819 m
# 7.25838 m
# 1.23784 m
# scene.objects['Map_text']['position_end']=scene.objects['Map_text'].worldPosition
# scene.objects['Map_text']['position_init']=scene.objects['Map_text'].worldPosition
# scene.objects['Map_text']['position_init'][0]=scene.objects['Map_text']['position_end'][0]-scene.objects['Map_text']['position_delta'][0]
# scene.objects['Map_text']['position_init'][1]=scene.objects['Map_text']['position_end'][1]-scene.objects['Map_text']['position_delta'][1]
# scene.objects['Map_text']['position_init'][2]=scene.objects['Map_text']['position_end'][2]-scene.objects['Map_text']['position_delta'][2]
# scene.objects['Map_text'].worldPosition=scene.objects['Map_text']['position_init']
scene.objects['Map_text']['anim']=True
print (scene.objects['Map_text']['position_init'])
print (scene.objects['Map_text']['timer'])
# scene.objects['Map_text']['position_end']=scene.objects['Map_text'].worldPosition
# scene.objects['Map_text']['position_init']=[0,0,0]
# scene.objects['Map_text']['position_init'][0]=scene.objects['Map_text']['position_end'][0]-scene.objects['Map_text']['position_delta'][0]
# scene.objects['Map_text']['position_init'][1]=scene.objects['Map_text']['position_end'][1]-scene.objects['Map_text']['position_delta'][1]
# scene.objects['Map_text']['position_init'][2]=scene.objects['Map_text']['position_end'][2]-scene.objects['Map_text']['position_delta'][2]
# scene.objects['Map_text'].worldPosition=scene.objects['Map_text']['position_init']
# scene.objects['Map_text']['anim']=True
# Texte de carte
def ct_map_text(text):
scene.objects['Map_text']['Text']=text