In order to make this animation, I can only write a script that allows the door to go to some fixed points (in fact coordinates) when the door is opening.
First, open "script\door.osc" (Please backup the original door.osc)
Under "{macro:Door_Frame}
(M.L.Door0_Calc)
(M.L.Door1_Calc)
(M.L.DoorAftCalc)
(M.L.Door2_Calc)
(M.L.Door3_Calc)",
add the following scripts:
"(M.L.Door2_framex) door 2 stands for the left back door and door 3 stands for the right back door.
(M.L.Door2_framey)
(M.L.Door3_framex)
(M.L.Door3_framey)"
Before the line "{macro:Door2_Calc}"
add the following scripts:
"{macro:Door2_framex}
(L.L.door_2) (F.L.door2_xposition) (S.L.door2_positionx)
{end}
{macro:Door2_framey}
(L.L.door_2) (F.L.door2_yposition) (S.L.door2_positiony)
{end}"
Before the line "{macro:Door3_Calc}",
add the following scripts:
"{macro:Door3_framex}
(L.L.door_3) (F.L.door3_xposition) (S.L.door3_positionx)
{end}
{macro:Door3_framey}
(L.L.door_3) (F.L.door3_yposition) (S.L.door3_positiony)
{end}"
Then, open door_constfile.txt. This file is where we set the coodinates of the moving door.,加呢幾行,並係度改數字:
Add these scripts at the beginning of the file:
"Door2 Xpoition
[newcurve]
door2_xposition
***x position refers to the x translation of the door. It indicates how far the door is pushed away from the original position.
The first value of [pnt] refers to the status of the door. 0 = close, 1 = open, values in the middle = opening.
The second value is the translation you want to make. 0 = no translation, other values indicates the movement. As we are now working on x translation, the door will move out of the original position if you set the value larger than 0.
[pnt]
0
0
[pnt]
0.3
0.7
[pnt]
1
1
** I have set 10 x- coordinates for the door of ATE to make the animation more realistc.
Door2 Ypoition
[newcurve]
door2_yposition
*** y referes to the movement along y axis, mearning opening the door to the left or to the right.
[pnt]
0
0
[pnt]
1
1
Door3 Xpoition
[newcurve]
door3_xposition
[pnt]
0
0
[pnt]
1
1
Door3 Ypoition
[newcurve]
door3_yposition
[pnt]
0
0
[pnt]
1
1
"
After that, go to door_varlist.txt. Add the following 4 lines at the back.
"door2_positionx
door3_positionx
door2_positiony
door3_positiony"
Lastly, go to model.cfg, where you locate your object with this animation.
For each of the door, we need to add 2 "newanim", 1 for _positionx, 1 for _positiony.
The command for triggering the animation is changed to door2_positionx, door2_positiony, door3_positionx and door3_positiony.
The animation for x-translation becomes below:
[newanim]
origin_trans
0
0
0
origin_rot_x
90
origin_rot_y
0
origin_rot_z
0
anim_trans
door2_positionx
-0.11 <== you can adjust this value and see how far the door is translated.
You can then set the animation for y-translation with scripts similar to the above one.
Please be reminded that we do not need to set origin_trans as we are just doing translation, not rotating about an axis.
Here is the result after you set all the coordinates: |