Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// @function skeletonHumanoidUpdate
- /// @param {instance} *instance
- with ((argument_count > 0) ? argument[0] : id)
- {
- var _angle = floor(direction / 90) % 4,
- _scale ,//= skeleton[SkeletonHumanoid.SCALE],
- _jointHead = skeleton[SkeletonHumanoid.JOINT_HEAD],
- _jointTorso = skeleton[SkeletonHumanoid.JOINT_TORSO],
- _jointShoulderLeft = skeleton[SkeletonHumanoid.JOINT_SHOULDER_LEFT],
- _jointShoulderRight = skeleton[SkeletonHumanoid.JOINT_SHOULDER_RIGHT],
- _jointLegLeft = skeleton[SkeletonHumanoid.JOINT_LEG_LEFT],
- _jointLegRight = skeleton[SkeletonHumanoid.JOINT_LEG_RIGHT],
- _jointKneeLeft = skeleton[SkeletonHumanoid.JOINT_KNEE_LEFT],
- _jointKneeRight = skeleton[SkeletonHumanoid.JOINT_KNEE_RIGHT],
- _pointHolster1 = skeleton[SkeletonHumanoid.POINT_HOLSTER_1],
- _pointHolster2 = skeleton[SkeletonHumanoid.POINT_HOLSTER_2],
- _headPos ,//= skeleton[SkeletonHumanoid.HEAD_POS],
- _torsoPos ,//= skeleton[SkeletonHumanoid.TORSO_POS],
- _armLeftUpperPos ,//= skeleton[SkeletonHumanoid.ARM_LEFT_UPPER_POS],
- _armLeftLowerPos ,//= skeleton[SkeletonHumanoid.ARM_LEFT_LOWER_POS],
- _armRightUpperPos ,//= skeleton[SkeletonHumanoid.ARM_RIGHT_UPPER_POS],
- _armRightLowerPos ,//= skeleton[SkeletonHumanoid.ARM_RIGHT_LOWER_POS],
- _legLeftUpperPos ,//= skeleton[SkeletonHumanoid.LEG_LEFT_UPPER_POS],
- _legLeftLowerPos ,//= skeleton[SkeletonHumanoid.LEG_LEFT_LOWER_POS],
- _legRightUpperPos ,//= skeleton[SkeletonHumanoid.LEG_RIGHT_UPPER_POS],
- _legRightLowerPos ,//= skeleton[SkeletonHumanoid.LEG_RIGHT_LOWER_POS],
- _stepSize = skeleton[SkeletonHumanoid.STEP_SIZE],
- _armSwing = skeleton[SkeletonHumanoid.ARM_SWING],
- _armLength = skeleton[SkeletonHumanoid.ARM_LENGTH],
- _anim = sin(moveTime * 15);
- var _armRot = [60, 120];
- switch (_angle)
- {
- case 0: // Right Up
- _scale = [1,1];
- _headPos = [_jointHead[0] * _scale[0],_jointHead[1] * _scale[1]];
- _torsoPos = [_jointTorso[0] * _scale[0],_jointTorso[1] * _scale[1]];
- _legLeftUpperPos = [_jointLegLeft[0], _jointLegLeft[1] - _stepSize * max(_anim, 0)];
- _legLeftLowerPos = [_jointKneeLeft[0], _jointKneeLeft[1] - _stepSize * 2 * max(_anim, 0)];
- _legRightUpperPos = [_jointLegRight[0], _jointLegRight[1] - _stepSize * max(-_anim, 0)];
- _legRightLowerPos = [_jointKneeRight[0], _jointKneeRight[1] - _stepSize * 2 * max(-_anim, 0)];
- if (holstered || (!holstered && is_undefined(weapon)))
- {
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], -_armSwing - 90];
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = _armRightLowerPos[2];
- }
- else
- {
- //var _armRot = [75.522, 180 - 28.955];
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], direction - _armRot[0]];
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2] + _armRot[1]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = direction;
- }
- break;
- case 1: // Left Up
- _scale = [1,1];
- _headPos = [_jointHead[0] * _scale[0],_jointHead[1] * _scale[1]];
- _torsoPos = [_jointTorso[0] * _scale[0],_jointTorso[1] * _scale[1]];
- _legLeftUpperPos = [_jointLegLeft[0], _jointLegLeft[1] - _stepSize * max(_anim, 0)];
- _legLeftLowerPos = [_jointKneeLeft[0], _jointKneeLeft[1] - _stepSize * 2 * max(_anim, 0)];
- _legRightUpperPos = [_jointLegRight[0], _jointLegRight[1] - _stepSize * max(-_anim, 0)];
- _legRightLowerPos = [_jointKneeRight[0], _jointKneeRight[1] - _stepSize * 2 * max(-_anim, 0)];
- if (holstered || (!holstered && is_undefined(weapon)))
- {
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], -_armSwing - 90];
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = _armRightLowerPos[2];
- }
- else
- {
- //var _armRot = [75.522, 180 - 28.955];
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], direction + _armRot[0] + 25]; // << Temp
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2] - _armRot[1]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = direction;
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = direction;
- }
- break;
- case 2: // Left Down
- _scale = [-1,1];
- _headPos = [_jointHead[0] * _scale[0],_jointHead[1] * _scale[1]];
- _torsoPos = [_jointTorso[0] * _scale[0],_jointTorso[1] * _scale[1]];
- _legLeftUpperPos = [_jointLegLeft[0], _jointLegLeft[1] - _stepSize * max(_anim, 0)];
- _legLeftLowerPos = [_jointKneeLeft[0], _jointKneeLeft[1] - _stepSize * 2 * max(_anim, 0)];
- _legRightUpperPos = [_jointLegRight[0], _jointLegRight[1] - _stepSize * max(-_anim, 0)];
- _legRightLowerPos = [_jointKneeRight[0], _jointKneeRight[1] - _stepSize * 2 * max(-_anim, 0)];
- if (holstered || (!holstered && is_undefined(weapon)))
- {
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], -_armSwing - 90];
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = _armRightLowerPos[2];
- }
- else
- {
- //var _armRot = [75.522, 180 - 28.955];
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], direction + _armRot[0] + 27]; // << Temp
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2] - _armRot[1]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = direction;
- }
- break;
- case 3: // Right Down
- _scale = [-1,1];
- _headPos = [_jointHead[0] * _scale[0],_jointHead[1] * _scale[1]];
- _torsoPos = [_jointTorso[0] * _scale[0],_jointTorso[1] * _scale[1]];
- _legLeftUpperPos = [_jointLegLeft[0], _jointLegLeft[1] - _stepSize * max(_anim, 0)];
- _legLeftLowerPos = [_jointKneeLeft[0], _jointKneeLeft[1] - _stepSize * 2 * max(_anim, 0)];
- _legRightUpperPos = [_jointLegRight[0], _jointLegRight[1] - _stepSize * max(-_anim, 0)];
- _legRightLowerPos = [_jointKneeRight[0], _jointKneeRight[1] - _stepSize * 2 * max(-_anim, 0)];
- if (holstered || (!holstered && is_undefined(weapon)))
- {
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], -_armSwing - 90];
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = _armRightLowerPos[2];
- }
- else
- {
- //var _armRot = [48.19, 48.19 * 2];
- //var _armRot = [75.522, 180 - 28.955];
- _armSwing = _armSwing * _scale[0] * _anim;
- _armLeftUpperPos = [_jointShoulderLeft[0] * _scale[0], _jointShoulderLeft[1] * _scale[1], _armSwing - 90];
- _armLeftLowerPos = [_armLeftUpperPos[0] + lengthdir_x(_armLength, _armLeftUpperPos[2]),_armLeftUpperPos[1] + lengthdir_y(_armLength, _armLeftUpperPos[2]), _armLeftUpperPos[2]];
- _armRightUpperPos = [_jointShoulderRight[0] * _scale[0], _jointShoulderRight[1] * _scale[1], direction - _armRot[0]];
- _armRightLowerPos = [_armRightUpperPos[0] + lengthdir_x(_armLength, _armRightUpperPos[2]),_armRightUpperPos[1] + lengthdir_y(_armLength, _armRightUpperPos[2]), _armRightUpperPos[2] + _armRot[1]];
- handLeft[2] = _armLeftLowerPos[2];
- handRight[2] = direction;
- }
- break;
- }
- handLeft = [x + _armLeftLowerPos[0] + lengthdir_x(_armLength, _armLeftLowerPos[2]), y + _armLeftLowerPos[1] + lengthdir_y(_armLength, _armLeftLowerPos[2]), handLeft[2]];
- handRight = [x + _armRightLowerPos[0] + lengthdir_x(_armLength, _armRightLowerPos[2]),y + _armRightLowerPos[1] + lengthdir_y(_armLength, _armRightLowerPos[2]),handRight[2]];
- holsterPoint[0,0] = x + _pointHolster1[0] * _scale[0];
- holsterPoint[0,1] = y + _pointHolster1[1] * _scale[1];
- holsterPoint[0,2] = 90 + angle_difference(_pointHolster1[2], 90) * _scale[0];
- holsterPoint[1,0] = x + _pointHolster2[0] * _scale[0];
- holsterPoint[1,1] = y + _pointHolster2[1] * _scale[1];
- holsterPoint[1,2] = 90 + angle_difference(_pointHolster2[2], 90) * _scale[0];
- if (is_defined(weapon))
- {
- if (holstered)
- {
- var _hand = weapon[? "Hands"] - 1;
- weaponTip = [holsterPoint[_hand,0],holsterPoint[_hand,1],shoulderY, holsterPoint[_hand,2]];
- }
- else
- {
- var _offset = weapon[? "Tip Offset"];
- if (abs(angle_difference(handRight[2], 0)) > 90) _offset[1] *= -1;
- weaponTip = [handRight[0] + lengthdir_x(_offset[0], handRight[2] + _offset[1]), handRight[1] + lengthdir_y(_offset[0], handRight[2] + _offset[1]), shoulderY, handRight[2]];
- }
- }
- skeleton[SkeletonHumanoid.HEAD_POS] = _headPos;
- skeleton[SkeletonHumanoid.TORSO_POS] = _torsoPos;
- skeleton[SkeletonHumanoid.ARM_LEFT_UPPER_POS] = _armLeftUpperPos;
- skeleton[SkeletonHumanoid.ARM_LEFT_LOWER_POS] = _armLeftLowerPos;
- skeleton[SkeletonHumanoid.ARM_RIGHT_UPPER_POS] = _armRightUpperPos;
- skeleton[SkeletonHumanoid.ARM_RIGHT_LOWER_POS] = _armRightLowerPos;
- skeleton[SkeletonHumanoid.LEG_LEFT_UPPER_POS] = _legLeftUpperPos;
- skeleton[SkeletonHumanoid.LEG_LEFT_LOWER_POS] = _legLeftLowerPos;
- skeleton[SkeletonHumanoid.LEG_RIGHT_UPPER_POS] = _legRightUpperPos;
- skeleton[SkeletonHumanoid.LEG_RIGHT_LOWER_POS] = _legRightLowerPos;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement