skinview3d
skinview3d copied to clipboard
Crouching
How would I go about making the player go into a crouched position?
This would require manipulating all the body parts into the desired "crouch" position.
It's currently not built into the library but contributions are welcomed.
Sounds like an interesting improvement. Can you point us in the Direction where to start?
I tried to write an crouching animiation. But i just write it by feeling.(All the numbers are written by my watching,so it could be something strange or doesn't work like the game) Here's the code,i hope the dev could improve it or realize this function. @Hacksore
var m=true; // m is used to control whether to crouch
skinViewer.animation=new skinview3d.FunctionAnimation((pl,pr1)=>{
pr=m
pl.skin.body.rotation.x=0.4537860552*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.body.position.z=1.3256181*Math.abs(Math.sin(pr*Math.PI/2))-3.4500310377*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.body.position.y=-6-2.1036774620*Math.abs(Math.sin(pr*Math.PI/2));
pl.cape.position.y=8-1.851236166577372*Math.abs(Math.sin(pr*Math.PI/2));
pl.cape.rotation.x=0.18849555921538758+0.294220265771*Math.abs(Math.sin(pr*Math.PI/2));
pl.cape.position.z=-2+3.786619432*Math.abs(Math.sin(pr*Math.PI/2))-3.4500310377*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.head.position.y=-3.618325234674*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.leftArm.position.z=3.618325234674*Math.abs(Math.sin(pr*Math.PI/2))-3.4500310377*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.rightArm.position.z=pl.skin.leftArm.position.z;
pl.skin.leftArm.rotation.x=0.410367746202*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.rightArm.rotation.x=pl.skin.leftArm.rotation.x;
pl.skin.leftArm.rotation.z=0.1;
pl.skin.rightArm.rotation.z=-pl.skin.leftArm.rotation.z;
pl.skin.leftArm.position.y=-2-2.53943318*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.rightArm.position.y=pl.skin.leftArm.position.y
pl.skin.rightLeg.position.z=-3.4500310377*Math.abs(Math.sin(pr*Math.PI/2));
pl.skin.leftLeg.position.z=pl.skin.rightLeg.position.z
/* === wave hand begin ==== */
t=pr1*18
pl.skin.rightArm.rotation.x = -0.4537860552+2*Math.sin(t + Math.PI) * 0.3-(!m?0.4537860552:0);
const basicArmRotationZ =0.01*Math.PI+0.06;
pl.skin.rightArm.rotation.z = -Math.cos(t) * 0.403 + basicArmRotationZ;
pl.skin.body.rotation.y = -Math.cos(t) * 0.06 ;
pl.skin.leftArm.rotation.x = Math.sin(t + Math.PI) * 0.077+0.47*m;
pl.skin.leftArm.rotation.z = -Math.cos(t) * 0.015 +0.13-(!m?0.05:0);
if(!m) {
pl.skin.leftArm.position.z=Math.cos(t) * 0.3;
pl.skin.leftArm.position.x=5-Math.cos(t) * 0.05;
}
/* === wave hand end ==== */
})
skinViewer.animation.speed=1;
This would require manipulating all the body parts into the desired "crouch" position.
It's currently not built into the library but contributions are welcomed.
By the way, how did you get the values of these animations? Is there any way to get these specific parameters from the game file? My stealth animation is entirely based on my own estimated value (even using a protractor to measure the angle). But if there is a way, please tell me how to get the game's own settings so that I can set these animations more accurately.