Right now we have methods
proto native void OverrideTurnSpeed(bool state, float turnSpeed);
proto native void OverrideHeading(bool state, float heading);
but this because as always is undocumented does not work for me well
I want method to directly set/get turn variable in animal animgraph which is sufficient in my opinion to control direction of animal, see attached video
Just turn without not need override heading and so on.
I tried add set turning variable into moddable movement, but it not work smoothly as in animeditor.
my code snipped of controlling horse:
hic = player.GetInputController(); //rotace kone //inputController.OverrideHeading(true, inputController.GetHeading()+(hic.GetAimChange()[0])); float movementX = input.SyncedValue_ID(UAMoveRight) - input.SyncedValue_ID(UAMoveLeft); float maxTurnSpeed = 100.0; movementX = Math.Clamp(movementX * maxTurnSpeed * pDt, -180, 180); //Print ("movementX "+ movementX); float heading = GetOrientation()[0] + movementX; //Print ("HEADING " + (heading * Math.DEG2RAD)); m_HorseTurn = movementX * 6.2; //POZOR stare toceni inputController.OverrideHeading(true, heading * Math.DEG2RAD ); inputController.OverrideTurnSpeed(true, Math.PI2 / pDt); hic.GetMovement(plrspeed,plrdirection); //Print("DIRECTION " + plrdirection); //Print ("Direction 2 " + plrdirection[2]); if ( plrdirection[2] < 0) { //Print("SET BACK"); m_AGDirection = 180; } else { m_AGDirection = 0; } float mspeed = plrspeed; if (plrspeed == 0) { SetStaminaValue(30+GetStaminaValue()); } if (plrspeed == 1) { mspeed = 3; SetStaminaValue(15+GetStaminaValue()); } if (plrspeed == 2) { mspeed = 3.8; //acceleration /* if (GetHorseSpeed() <3) { SetHorseSpeed(3); } */ SetStaminaValue(8+GetStaminaValue()); } if (plrspeed >= 3 && GetStaminaValue() > 2000) { mspeed = 5.2; SetStaminaValue(-8+GetStaminaValue()); } else if (plrspeed >= 3 && GetStaminaValue() <= 2000 && GetStaminaValue() > 1000) { mspeed = 3.8; SetStaminaValue(-8+GetStaminaValue()); } else if (plrspeed >= 3 && GetStaminaValue() <= 1000) { mspeed = 3.8; SetStaminaValue(8+GetStaminaValue()); } if (m_AGDirection == 0 && !CanMoveForward()) { mspeed = 0; } if (m_AGDirection == 180 && !CanMoveBackward()) { mspeed = 0; } // acceleration //SetHorseSpeed(GetHorseSpeed()+m_HorseAcceleration*pDt); //inputController.OverrideMovementSpeed(true, Math.Clamp(GetHorseSpeed(),0,mspeed)); inputController.OverrideMovementSpeed(true, mspeed); if (hic.IsJumpClimb() && !ShouldSwim() && CanJump() && GetStaminaValue() > 800) { inputController.OverrideJump(true, 101, 100); SetStaminaValue(-800+GetStaminaValue()); } else { inputController.OverrideJump(false, 0, 0); }
how I am adding turn into movement
modded class DayZAnimalCommandMoveModdable { override void PreAnimUpdate( float pDt ) { Horse_Base horse = Horse_Base.Cast(GetEntity()); if (horse && horse.GetAnimST()) { //behaviour slot 3 - enraged //dog.GetAnimST().SetBehaviorSlotIDM(this, 3); //dog.GetAnimST().SetAlertLevelM(this,3); horse.GetAnimST().SetDirectionM(this, horse.GetAGDirection()); horse.GetAnimST().SetWildM(this, horse.IsWild()); horse.GetAnimST().SetSwimM(this, horse.ShouldSwim()); horse.GetAnimST().SetFallM(this, horse.ShouldFall()); horse.GetAnimST().SetTurnM(this, horse.GetHorseTurn()); } super.PreAnimUpdate( pDt ); } }