unrealwiki:Scratchpad: Difference between revisions

From Unreal Wiki, The Unreal Engine Documentation Site
ShreeK (talk | contribs)
No edit summary
No edit summary
 
(55 intermediate revisions by 11 users not shown)
Line 1: Line 1:
__NOTOC__
This page is for pasting code you want to show someone as an example or to get assistance with.  This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.
This page is for pasting code you want to show someone as an example or to get assistance with.  This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.


You are free to remove any existing code from below, and paste your code between the <nowiki><uscript> </uscript></nowiki> tags.  If the page hasn't been edited in 24 hours, you can assume it isn't needed anymore and can be removed.  A full <span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=history}} edit history]</span> will be available, so don't worry about losing anything.
You are free to remove any existing code from below, and paste your code between the <nowiki><uscript> </uscript></nowiki> tags.  If the page hasn't been edited in the last few hours (the last edit timestamp is {{timestamp}}), you can assume it isn't needed anymore and can be removed.  A full <span class="plainlinks">[{{fullurl:{{FULLPAGENAME}}|action=history}} edit history]</span> will be available, so don't worry about losing anything you removed.


'''Clean up after you're done!'''
----
----


<uscript>
<uscript>
    // if spider mode, update rotation based on floor
// paste your code here
    function UpdateRotation(float DeltaTime, float maxPitch)
</uscript>
    {
    local vector X,Y,Z;
        local rotator ViewRotation;
        local vector MyFloor, CrossDir, FwdDir, OldFwdDir, OldX, RealFloor;
 
        if ( bInterpolating || Pawn.bInterpolating )
        {
            ViewShake(deltaTime);
            return;
        }
 
GetAxes(Rotation,X,Y,Z);
 
        TurnTarget = None;
        bRotateToDesired = false;
        bSetTurnRot = false;


if (PolarityPawn(Pawn).currentSurfaceNormal == -oldSurfaceNormal)
====Full Key====
MyFloor = oldSurfaceNormal Cross X;
* <sup>1</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 1]].
else
* <sup>2</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]].
        MyFloor = PolarityPawn(Pawn).currentSurfaceNormal;
* <sup>2+</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]], from this version onwards.
 
* <sup>2x</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 2]], starting with [[UT2004]].
        if ( MyFloor != oldSurfaceNormal )
* <sup>3</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]].
        {
* <sup>3+</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]], starting with [[UT3]] patch 2.0.
            // smoothly change floor
* <sup>3*</sup> &ndash; {'''$Topic''' is relevant/available to/in} [[Unreal Engine 3]], starting with [[UDK]].
            RealFloor = MyFloor;
* (no number) &ndash; {'''$Topic''' is relevant/available to/in} all Unreal Engine generations.
            MyFloor = Normal(6*DeltaTime * MyFloor + (1 - 6*DeltaTime) * oldSurfaceNormal);
<br>
            if ( (RealFloor Dot MyFloor) > 0.9999 )
====Enum Key====
                MyFloor = RealFloor;
{{classgames|Vector}}<sup>--|</sup><br>
else
{{classgames|Range}}<sup>--|'''2'''</sup><br>
{
{{classgames|Vector2D}}<sup>--|'''3'''</sup><br>
// translate view direction
{{classgames|Color}}<br>
CrossDir = Normal(RealFloor Cross oldSurfaceNormal);
{{classgames|LinearColor}}<br>
FwdDir = CrossDir Cross MyFloor;
<br>
OldFwdDir = CrossDir Cross oldSurfaceNormal;
====Class Key====
X = MyFloor * (oldSurfaceNormal Dot X)
{{classgames|Actor}}<br>
+ CrossDir * (CrossDir Dot X)
{{classgames|Rook}}<br> - TribesV?
+ FwdDir * (OldFwdDir Dot X);
{{classgames|SoundCue}}<br>
X = Normal(X);
{{classgames|UTGreedGame}}<br>
 
{{classgames|LegendObjectComponent}}<br>
Z = MyFloor * (oldSurfaceNormal Dot Z)
{{classgames|FluidSurfaceOscillator}}<br>
+ CrossDir * (CrossDir Dot Z)
{{classgames|Ammunition}}<br>
+ FwdDir * (OldFwdDir Dot Z);
{{classgames|Util}}<br>
Z = Normal(Z);
{{classgames|xUtil}} -UE2??<br>
oldSurfaceNormal = MyFloor;
{{classgames|UnrealPlayer}}<br>
Y = Normal(MyFloor Cross X);
{{classgames|xPlayer}} -UE2??<br>
}
{{classgames|UTPlayerController}}<br>
        }
{{classgames|WeaponFire}}
 
<br>
        if ( (aTurn != 0) || (aLookUp != 0) )
====Keyword Key====
        {
{{classgames|Expands}}<br>
            // adjust Yaw based on aTurn
{{classgames|Extends}}<br>
            if ( aTurn != 0 )
{{classgames|server}}<br>
                X = Normal(X + 3 * Y * Sin(0.0005*DeltaTime*aTurn));
{{classgames|replicated}}<br>
 
{{classgames|intrinsic}}<br>
            // adjust Pitch based on aLookUp
            if ( aLookUp != 0 )
            {
                OldX = X;
                X = Normal(X + 3 * Z * Sin(0.0005*DeltaTime*aLookUp));
                Z = Normal(X Cross Y);
 
                // bound max pitch
                if ( (Z Dot MyFloor) < 0.25 /* was 0.707 */ )
// TODO FIX CAMERA PITCH EXTREMES
                {
                ClientMessage("OldX: " $ OldX);
                    OldX = 0.252*Normal(OldX - MyFloor * (MyFloor Dot OldX));
              // WAS:    OldX = Normal(OldX - MyFloor * (MyFloor Dot OldX));
                ClientMessage("New OldX: " $ OldX);
                   
                    if ( (X Dot MyFloor) > 0)
                        X = Normal(OldX + MyFloor);
                    else
                        X = Normal(OldX - MyFloor);
ClientMessage("FinalX: " $ X);
                    Z = Normal(X Cross Y);
                }
               
            }
 
            // calculate new Y axis
            Y = Normal(MyFloor Cross X);
        }
        ViewRotation =  OrthoRotation(X,Y,Z);
        SetRotation(ViewRotation);
        ViewShake(deltaTime);
        ViewFlash(deltaTime);
        Pawn.FaceRotation(ViewRotation, deltaTime );
    }
</uscript>

Latest revision as of 08:41, 6 October 2011

This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.

You are free to remove any existing code from below, and paste your code between the <uscript> </uscript> tags. If the page hasn't been edited in the last few hours (the last edit timestamp is 2011-10-06 08:41:16), you can assume it isn't needed anymore and can be removed. A full edit history will be available, so don't worry about losing anything you removed.

Clean up after you're done!


// paste your code here

Full Key

  • 1 – {$Topic is relevant/available to/in} Unreal Engine 1.
  • 2 – {$Topic is relevant/available to/in} Unreal Engine 2.
  • 2+ – {$Topic is relevant/available to/in} Unreal Engine 2, from this version onwards.
  • 2x – {$Topic is relevant/available to/in} Unreal Engine 2, starting with UT2004.
  • 3 – {$Topic is relevant/available to/in} Unreal Engine 3.
  • 3+ – {$Topic is relevant/available to/in} Unreal Engine 3, starting with UT3 patch 2.0.
  • 3* – {$Topic is relevant/available to/in} Unreal Engine 3, starting with UDK.
  • (no number) – {$Topic is relevant/available to/in} all Unreal Engine generations.


Enum Key

Vector

()

--|
Range

()

--|2
Vector2D

()

--|3
Color

()


LinearColor

()



Class Key

Actor

()


Rook(no matching games found)
- TribesV?

SoundCue

()


UTGreedGame

()


LegendObjectComponent

()


FluidSurfaceOscillator

()


Ammunition

()


Util

()


xUtil(no matching games found) -UE2??

UnrealPlayer

()


xPlayer(no matching games found) -UE2??

UTPlayerController

()


WeaponFire

()


Keyword Key

Expands(no matching games found)
Extends(no matching games found)
server(no matching games found)
replicated(no matching games found)
intrinsic(no matching games found)