forked from Mirrors/openclonk
Clonk: Adjust mesh position while diving
This matches the vertex position betterinstall-platforms
parent
f8f9a38ee3
commit
06cd643d15
|
@ -1040,6 +1040,7 @@ func FxIntSwimStart(pTarget, effect, fTmp)
|
|||
func FxIntSwimTimer(pTarget, effect, iTime)
|
||||
{
|
||||
var iSpeed = Distance(0,0,GetXDir(),GetYDir());
|
||||
SetMeshTransformation(nil, CLONK_MESH_TRANSFORM_SLOT_Translation_Dive);
|
||||
|
||||
// TODO: Smaller transition time between dive<->swim, keep 15 for swimstand<->swim/swimstand<->dive
|
||||
|
||||
|
@ -1109,6 +1110,7 @@ func FxIntSwimTimer(pTarget, effect, iTime)
|
|||
// TODO: This should depend on which animation we come from
|
||||
// Guess for SwimStand we should fade from 0, otherwise from 90.
|
||||
effect.rot = 90;
|
||||
effect.yoff = 0;
|
||||
}
|
||||
|
||||
if(iSpeed)
|
||||
|
@ -1120,9 +1122,21 @@ func FxIntSwimTimer(pTarget, effect, iTime)
|
|||
// TODO: Shouldn't weight go by sin^2 or cos^2 instead of linear in angle?
|
||||
var weight = 1000*effect.rot/180;
|
||||
SetAnimationWeight(effect.animation, Anim_Const(1000 - weight));
|
||||
|
||||
// Adjust graphics position so that it matches the vertices (offset 0 to -5000, with -5000 at 90 degrees or less, while diving down)
|
||||
var y_adjust = -Sin(BoundBy(effect.rot, 90, 180), 5000);
|
||||
effect.yoff += BoundBy(y_adjust - effect.yoff, -100, 100);
|
||||
SetMeshTransformation(Trans_Translate(0, effect.yoff, 0), CLONK_MESH_TRANSFORM_SLOT_Translation_Dive);
|
||||
}
|
||||
}
|
||||
|
||||
func FxIntSwimStop(object target, proplist effect, int reason, temp)
|
||||
{
|
||||
if (temp) return;
|
||||
|
||||
SetMeshTransformation(nil, CLONK_MESH_TRANSFORM_SLOT_Translation_Dive);
|
||||
}
|
||||
|
||||
func GetSwimRotation()
|
||||
{
|
||||
var effect = GetEffect("IntSwim", this);
|
||||
|
|
|
@ -22,6 +22,7 @@ static const CLONK_MESH_TRANSFORM_SLOT_Translation_Hook = 2; // for adjusting th
|
|||
static const CLONK_MESH_TRANSFORM_SLOT_Rotation_Hook = 3; // for adjusting the rotation while scaling
|
||||
static const CLONK_MESH_TRANSFORM_SLOT_Rotation_Ladder = 5; // for adjusting the rotation while climbing a rope ladder
|
||||
static const CLONK_MESH_TRANSFORM_SLOT_Scale = 6; // for scaling the size of the clonk
|
||||
static const CLONK_MESH_TRANSFORM_SLOT_Translation_Dive = 7; // for adjusting the position while diving
|
||||
|
||||
// ladder climbing
|
||||
#include Library_CanClimbLadder
|
||||
|
|
Loading…
Reference in New Issue