fix: rotation on getting hit fixed
This commit is contained in:
@@ -45,10 +45,10 @@ public class UnitCombat : MonoBehaviour{
|
||||
Debug.LogError($"No available UnitMovement on {draggedUnit.name}. Aborting drag on this unit.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
draggedUnitMovement.SetNewRotation(-transform.position.DirectionTo(draggedUnit.transform.position), 1f, true);
|
||||
draggedUnitMovement.SetNewDirection((positionDelta).ToVector2(), 1f, true);
|
||||
draggedUnitMovement.SetNewSpeed(speedDelta, 1f, true);
|
||||
draggedUnitMovement.SetNewRotation(-transform.position.DirectionTo(draggedUnit.transform.position), 1f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Player : NetworkBehaviour, IKillable{
|
||||
void Start(){
|
||||
if (((IKillable)this).maxHealth == 0f) {
|
||||
Debug.LogError($"Max health is not set for type of <b>{name}</b>. Setting to 100.");
|
||||
((IKillable)this).currentHealth = 100f;
|
||||
((IKillable)this).currentHealth = 10000f;
|
||||
} else {
|
||||
((IKillable)this).currentHealth = ((IKillable)this).maxHealth;
|
||||
}
|
||||
|
||||
@@ -246,14 +246,18 @@ namespace Reset.Units{
|
||||
}
|
||||
|
||||
public void SetNewRotation(Vector3 value, float relativity, bool absolute, Vector3 relativeTo = default){ // new
|
||||
Vector3 relativeValue = Quaternion.LookRotation(relativeTo) * value;
|
||||
Quaternion valueAsQuaternion = Quaternion.Euler(relativeValue);
|
||||
Quaternion valueAsQuaternion = Quaternion.LookRotation(value);
|
||||
|
||||
if (relativeTo != default) {
|
||||
valueAsQuaternion = Quaternion.LookRotation(relativeTo) * valueAsQuaternion;
|
||||
}
|
||||
|
||||
if (absolute){
|
||||
resolvedMovement.rotation = Quaternion.Lerp(resolvedMovement.rotation, valueAsQuaternion, relativity);
|
||||
} else {
|
||||
resolvedMovement.rotation = Quaternion.Lerp(resolvedMovement.rotation, resolvedMovement.rotation * valueAsQuaternion, relativity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SetSpecifiedRotation(Vector3 inputRotation){
|
||||
|
||||
Reference in New Issue
Block a user