mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Fix previous commit to work with view bobbing. (Thanks BPzeBanshee)
This commit is contained in:
parent
e6fd65a61f
commit
4dff63a70f
@ -36,9 +36,10 @@ namespace ClassicalSharp.Renderers {
|
|||||||
public void Render( double delta, float t ) {
|
public void Render( double delta, float t ) {
|
||||||
if( game.Camera.IsThirdPerson || !game.ShowBlockInHand ) return;
|
if( game.Camera.IsThirdPerson || !game.ShowBlockInHand ) return;
|
||||||
|
|
||||||
|
Vector3 last = fakeP.Position;
|
||||||
|
fakeP.Position = Vector3.Zero;
|
||||||
type = (byte)game.Inventory.HeldBlock;
|
type = (byte)game.Inventory.HeldBlock;
|
||||||
if( playAnimation )
|
if( playAnimation ) DoAnimation( delta, last );
|
||||||
DoAnimation( delta );
|
|
||||||
PerformViewBobbing( t );
|
PerformViewBobbing( t );
|
||||||
SetupMatrices();
|
SetupMatrices();
|
||||||
|
|
||||||
@ -68,23 +69,18 @@ namespace ClassicalSharp.Renderers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double animPeriod = 0.25, animSpeed = Math.PI / 0.25;
|
double animPeriod = 0.25, animSpeed = Math.PI / 0.25;
|
||||||
void DoAnimation( double delta ) {
|
void DoAnimation( double delta, Vector3 last ) {
|
||||||
if( swingAnimation || !leftAnimation ) {
|
if( swingAnimation || !leftAnimation ) {
|
||||||
float oldY = fakeP.Position.Y;
|
|
||||||
fakeP.Position.X = 0;
|
|
||||||
fakeP.Position.Y = -1.2f * (float)Math.Sin( animTime * animSpeed );
|
fakeP.Position.Y = -1.2f * (float)Math.Sin( animTime * animSpeed );
|
||||||
fakeP.Position.Z = 0;
|
|
||||||
|
|
||||||
if( swingAnimation ) {
|
if( swingAnimation ) {
|
||||||
// i.e. the block has gone to bottom of screen and is now returning back up
|
// i.e. the block has gone to bottom of screen and is now returning back up
|
||||||
// at this point we switch over to the new held block.
|
// at this point we switch over to the new held block.
|
||||||
if( fakeP.Position.Y > oldY )
|
if( fakeP.Position.Y > last.Y )
|
||||||
lastType = type;
|
lastType = type;
|
||||||
type = lastType;
|
type = lastType;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//fakePlayer.Position.X = 0.2f * (float)Math.Sin( animTime * animSpeed );
|
//fakePlayer.Position.X = 0.2f * (float)Math.Sin( animTime * animSpeed );
|
||||||
fakeP.Position.X = 0;
|
|
||||||
fakeP.Position.Y = 0.3f * (float)Math.Sin( animTime * animSpeed * 2 );
|
fakeP.Position.Y = 0.3f * (float)Math.Sin( animTime * animSpeed * 2 );
|
||||||
fakeP.Position.Z = -0.7f * (float)Math.Sin( animTime * animSpeed );
|
fakeP.Position.Z = -0.7f * (float)Math.Sin( animTime * animSpeed );
|
||||||
angleX = 20 * (float)Math.Sin( animTime * animSpeed * 2 );
|
angleX = 20 * (float)Math.Sin( animTime * animSpeed * 2 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user