Jump to content
Unity Insider Forum

Dont Clip


Crashdash

Recommended Posts

Und ich bin's wieder. :D

 

Habe jetzt versucht, meinen Character davon abzuhalten, steile wände hochzulaufen. Mal wieder kläglich.

// X and Z first. We don't want the sloped ground to prevent
                // Player from falling enough to touch the ground.
                Vector3 displacement;
                displacement.x = velocity.x * Time.deltaTime;
                displacement.y = 0;
                displacement.z = -PlayerController.transform.position.z;
                characterController.Move(displacement);
                // Now Y
                displacement.y = velocity.y * Time.deltaTime;
                // Our steepest down slope is 45 degrees. Force Player to fall at least
                // that much so he stays in contact with the ground.
                if (-Mathf.Abs(displacement.x) < displacement.y && displacement.y < 0)
                {
                    displacement.y = -Mathf.Abs(displacement.x) - 0.001f;
                }
                displacement.z = 0;
                displacement.x = 0;
                characterController.Move(displacement);

Link zu diesem Kommentar
Auf anderen Seiten teilen

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Auf dieses Thema antworten...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Lädt...
×
×
  • Neu erstellen...