1#include "Library/Movement/WheelMovement.h"
2
3#include "Library/LiveActor/LiveActor.h"
4#include "Library/Math/MathUtil.h"
5#include "Library/Placement/PlacementFunction.h"
6#include "Library/Rail/RailUtil.h"
7
8namespace al {
9WheelMovement::WheelMovement(LiveActor* actor, const ActorInitInfo& info)
10 : NerveExecutor("車輪動作計算") {
11 tryGetArg(arg: (s32*)&mRotateAxis, initInfo: info, key: "RotateAxis");
12 tryGetArg(arg: &mRotateAccel, initInfo: info, key: "RotateAccel");
13 tryGetArg(arg: &mMoveEndDegree, initInfo: info, key: "MoveEndDegree");
14 tryGetArg(arg: &mNoRotateWidth, initInfo: info, key: "NoRotateWidth");
15
16 getQuat(quat: &_20, initInfo: info);
17 _10 = _20;
18
19 sead::Vector3f localRotateAxis = sead::Vector3f::ex;
20 calcQuatLocalAxis(&localRotateAxis, _20, (s32)mRotateAxis);
21
22 mMoveDir.setCross(a: localRotateAxis, b: sead::Vector3f::ey);
23 if (isNearZero(vec: mMoveDir))
24 mMoveDir = sead::Vector3f::ez;
25
26 if (isExistRail(railHolder: actor)) {
27 setSyncRailToNearestPos(actor);
28 _64 = true;
29 mIsRailPlusDir = isRailPlusDir(railHolder: actor, mMoveDir);
30 f32 railProgress = getRailCoord(railHolder: actor) / getRailTotalLength(railHolder: actor);
31 _5c = railProgress;
32 _60 = railProgress;
33
34 if (mIsRailPlusDir)
35 _44 = railProgress * mMoveEndDegree;
36 else
37 _44 = -(railProgress * mMoveEndDegree);
38
39 rotateQuatLocalDirDegree(&_10, _20, (s32)mRotateAxis, modf(a: _44 + 360.0f, b: 360.0f) + 0.0f);
40 }
41}
42} // namespace al
43