ºÇ¿·ÈǤǤâÉÔ¶ñ¹ç¤Ï½¤Àµ¤µ¤ì¤Æ¤¤¤Ê¤¤¤è¤¦¤Ê¤Î¤ÇfvdirÌ¿Îá¤òÄɲ乤ë¥â¥¸¥å¡¼¥ë¤òºî¤Ã¤Æ¤ß¤¿
¤«¤Ê¤é¤º#include "hgimg4.as"¤Î¸å¤ËÁÞÆþ
hgimg3¤Î¤È¤Ï¾¯¤·°ã¤¤Y¼´¤òȿž¤·¤Ê¤¯¤ÆÎɤ¤
#include "hgimg4.as"
#module
#undef fvdir
#deffunc fvdir array fv,double _vx,double _vy,double _vz
dup ay,fv(1) //¼Â¿ô¤ÎÇÛÎó¤ò3²ó°Ê¾å»²¾È¤¹¤ë¤è¤êdup¤ÇÊÑ¿ô¤Ë¤·¤¿Êý¤¬¤Á¤ç¤Ã¤È¤À¤±·Ú¤¤
dup az,fv(2)
vx=_vx*cos(az)-_vy*sin(az)
vy=_vx*sin(az)+_vy*cos(az)
vx1=vx*cos(ay)+_vz*sin(ay)
vz1=-vx*sin(ay)+_vz*cos(ay)
fv(1)=vy*cos(fv)-vz1*sin(fv)
fv(2)=vy*sin(fv)+vz1*cos(fv)
fv=vx1
return
#global
gpreset
setcls CLSMODE_SOLID, $4040
setcolor GPOBJ_LIGHT, 1,1,1 ; ¥é¥¤¥È¥«¥é¡¼¤òÀßÄê
setdir GPOBJ_LIGHT, 0.5,0.5,0.5 ; ¥¢¥ó¥Ó¥¨¥ó¥È¥«¥é¡¼¤òÀßÄê
chdir dir_exe+"\\sample\\\hgimg4"
gpload id_model,"res/duck" ; ¥â¥Ç¥ëÆɤ߹þ¤ß
gpclone id_model(1), id_model ; ºÇ½é¤Î¥â¥Ç¥ë°Ê¹ß¤Ï¥¯¥í¡¼¥ó
xx=0.0
yy=0.0
zz=0.0
setpos id_model,0,0,0
//¤ª¤Þ¤±¤Ç»Ò¤ÎÀܳ°ÌÃÖ¤ò¸åÊý¤Ë¤º¤é¤·¤Æ³ÑÅÙ¤òÊѤ¨¤ë¥µ¥ó¥×¥ë¡Ê¥ª¥¤¥é¡¼³Ñ²óž¤Ê¤Î¤ÇXZ¼´Î¾Êý²óž¤µ¤»¤ë¤È¤ª¤«¤·¤¯¤Ê¤ë¡Ë
gpclone id_Parent, id_model
gpclone id_Child, id_model
Parent_angx=0.0
Parent_angy=0.0
Parent_angz=0.0
Child_angx=0.0
Child_angy=0.0
Child_angz=0.0
setpos id_Parent,0,-3,10
setpos GPOBJ_CAMERA,0.0,00.0,20.001
repeat
stick key,15
if key&128 : end
redraw 0 ; ÉÁ²è³«»Ï
; ¥«¡¼¥½¥ë¥¡¼¤Ç¥«¥á¥é°ÌÃÖ¤òÆ°¤«¤¹
if key&1 : addpos GPOBJ_CAMERA, -1, 0
if key&4 : addpos GPOBJ_CAMERA, 1, 0
if key&8 : addpos GPOBJ_CAMERA, 0, 1
if key&2 : addpos GPOBJ_CAMERA, 0, -1
yy+0.04
xx+0.03
zz+0.01
getpos id_model,x,y,z
gplookat GPOBJ_CAMERA, x,y,z ; ¥«¥á¥é¤«¤é»ØÄꤷ¤¿ºÂɸ¤ò¸«¤ë
setpos id_model,x,y,z
setang id_model,xx,yy,zz
setang id_model(1),xx,yy,zz
fvset fv,xx,yy,zz
fvdir fv,-1.5, 0.0, 0.0
setpos id_model(1),x+fv,y+fv(1),z+fv(2)
//¤ª¤Þ¤±
Parent_angx=sin(0.02*cnt)
Parent_angy+0.01
angx=Parent_angx
angy=Parent_angy+sin(0.1*cnt)*0.4
angz=Parent_angz
setang id_Parent,angx,angy,angz //¿Æ¤Î¸«¤¿ÌܤΥ¢¥ó¥°¥ë
fvset fv,Parent_angx,Parent_angy,Parent_angz //¿Ê¤àÊý¸þ
fvdir fv,0.05, 0.0, 0.0
selpos id_Parent
objaddfv fv
getpos id_Parent,x,y,z
setpos id_Child,x,y,z
Child_angy=-sin(0.1*cnt)*0.6 //»Ò¤Î³ÑÅÙ
setang id_Child,angx,angy,angz //¿Æ¤Î¸«¤¿ÌܤγÑÅÙ¤ò¥»¥Ã¥È
addang id_Child,Child_angx,Child_angy,Child_angz //»Ò¤Î³ÑÅÙ¤òÄɲÃ
fvset fv,angx,angy,angz //¿Æ¤Î¸«¤¿ÌܤΥ¢¥ó¥°¥ë¤«¤é¸åÊý¤Î¥í¡¼¥«¥ëºÂɸ
fvdir fv,-0.8, 0.0, 0.0
fvset cfv,Child_angx,Child_angy,Child_angz //getang¤¬Ìµ¤¤¤Î¤Ç¡¦¡¦¡¦
fvadd cfv,angx,angy,angz
fvdir cfv,-0.8, 0.0, 0.0
fvadd fv,cfv,cfv(1),cfv(2) //¸åÊý¤Î¥í¡¼¥«¥ëºÂɸ¤Ë²Ã»»
selpos id_Child
objaddfv fv
gpdraw ; ¥·¡¼¥ó¤ÎÉÁ²è
redraw 1 ; ÉÁ²è½ªÎ»
await 1000/60 ; ÂÔ¤Á»þ´Ö
loop