PDA

View Full Version : vectors, rotators what so ever; I need help


2COOL4-U
6th Nov 2001, 10:35 AM
I am working on a special gun and I never worked with vectors before, now I want to spawn 4 acotrs that each travel in a different direction from each other with a difference of 90 degrees between two actors, so if you saw it from a top view it would look like the attachment. I spawn them in a projectile class(I want those four to appear after the projectile hit the target.) Any idea?

Magus
6th Nov 2001, 11:11 AM
function explode(vector HitLocation,vecote HitNormal)
{
local rotator AimRotation;
local int i;

for(i=0;i<4;i++)
{
spawn(class'WhatEverClass',,,HitLocation+HitNormal*8,AimRotation);
AimRotation.Yaw += 16384; //rotates aim 90 degrees before spawning next thing
}
}

2COOL4-U
6th Nov 2001, 01:54 PM
HitLocation+HitNormal*8,AimRotation

What do the hitlocation and hitnormal vector store and what's the restult when you add them?

Magus
6th Nov 2001, 04:31 PM
HitLocation is the vector that stores where the actors hit.
HitNormal is the direction at which the actors hit. Very useful with

HitLocation is given to you from processTouch, when the projectile hits another actor. HitNormal can be found easily by taking the Normal(HitLocation-Other.Location) in processTouch.

The result of adding two vecotrs is a vector. And by adding these two vectors it tells you the direction and stuff at which it hit, so that you can spawn the actor/effect facing the right direction and stuff.

More information about vectors and rotators check out this tutorial at Chimeric on vectors and rotators (http://www.unrealscript.com/tutorials/vectors.php)