<UPDATE>
Found the solution: Rotator(M - P)
(So easy... For results see map "MH-Beginning_{HoF}" on servers using my MapPatcher)
</UPDATE>
I want to spawn some class'U' at location P(x1/y1/z1), give them the mesh of a ScriptedPawn and want to rotate them in that way that they are looking to a certain point M(x0/y0/z0). So the normal vector V should be V = M - P. How can I translate that vector into the rotation?
Vector to Rotator
Vector to Rotator
- Attachments
-
- Vectors.png (5.66 KiB) Viewed 442 times
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
Re: Vector to Rotator
Who says girls aren't good at math?
I don't know anything about coding anything. I'm glad you figured it out.
Good job!
I don't know anything about coding anything. I'm glad you figured it out.
Good job!
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Vector to Rotator
Code: Select all
function DoSayReach()
{
if ( P != None ) //P is PlayerPawn owner and paths seeker
{
if ( bWorking )
{
P.ClearProgressMessages();
P.SetProgressMessage("Destination is Reachable!",1);
clMsg.R=255;
clMsg.G=128;
clMsg.B=0;
P.SetProgressColor(clMsg,1);
P.SetProgressTime(3);
DoResetChilds();
NewRot = Rotator(P.Destination - P.Location); //Occurs if target is reachable because you might fail to see it
P.ClientSetLocation(P.Location,NewRot);
bWorking=False;
}
}
}
Re: Vector to Rotator
Condense it to
Code: Select all
P.ClientSetLocation(P.Location, Rotator(P.Destination - P.Location);
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Vector to Rotator
Umm... yep, I'll reduce resources data this way and removing new variable...
Edit: Now I want to learn and keep in my head a free trace of certain actor in direction where actor is facing - something like 300 UU in front of my eyes.
Purpose: Testing Playerstarts if are facing a wall - the crap kills people at RocketLauncher arenas without real spawnkill protections.
The plan is reporting these without checking each PlayerStart wasting a lot of time.
Edit: Now I want to learn and keep in my head a free trace of certain actor in direction where actor is facing - something like 300 UU in front of my eyes.
Purpose: Testing Playerstarts if are facing a wall - the crap kills people at RocketLauncher arenas without real spawnkill protections.
The plan is reporting these without checking each PlayerStart wasting a lot of time.
Re: Vector to Rotator
Desired point:sektor2111 wrote: ↑Sun Sep 27, 2020 12:00 pm I want to learn and keep in my head a free trace of certain actor in direction where actor is facing - something like 300 UU in front of my eyes.
Code: Select all
vector Target;
Target = PlayerStart.Location + vector(PlayerStart.Rotation)*300;
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Vector to Rotator
I see...
I wrote this a few minutes ago... but I'll look at your solution - it looks more simple.
I wrote this a few minutes ago... but I'll look at your solution - it looks more simple.
Code: Select all
function bool WallFacing(Actor A) //Inspired from Mercenary
{
local rotator AdjRot;
local vector EndTrace, RotDir;
local bool bFreeDir;
if ( A == None || A.bDeleteMe ) //Should log this funky situation ?
return False;
AdjRot = A.Rotation;
RotDir = vector(AdjRot);
EndTrace = A.Location + 280 * RotDir;
bFreeDir = A.FastTrace(EndTrace,A.Location);
return !bFreeDir;
}