Fix blood bug again and start camera at player

This commit is contained in:
Jens Pitkänen 2019-08-04 21:30:05 +03:00
parent 9d039e8750
commit 86ecaaf7a3
2 changed files with 2 additions and 1 deletions

View File

@ -35,7 +35,7 @@ namespace Saltosion.OneWeapon {
Vector2 AppliedMovement = Velocity * Time.fixedDeltaTime;
RaycastHit2D Hit = Physics2D.Raycast(transform.position, AppliedMovement, AppliedMovement.magnitude);
if (Hit.rigidbody != null) {
if (Hit.rigidbody != null && Hit.rigidbody.gameObject == Hit.collider.gameObject) {
bool IsStatic = Hit.rigidbody.bodyType == RigidbodyType2D.Static;
Velocity = Velocity.normalized * Mathf.Min(IsStatic ? 15.0f : 60.0f, Velocity.magnitude);
CurrentlyStuckOn = Hit.rigidbody;

View File

@ -18,6 +18,7 @@ namespace Saltosion.OneWeapon {
private void Start() {
Camera = GetComponent<Camera>();
Offset = transform.position;
transform.position = Player.position + Offset;
}
private void Update() {