I've been working on a new type of rocket for the past 7 hours or so. My goal is to make a seeking rocket that follows a path which "wobbles". It's hard to explain I know. I can almost get it to work but I have two problems. What is the proper way to modify a vector?
rRand.Pitch = (rand(4097)-2048);
rRand.Yaw = (rand(4097)-2048);
rRand.Roll = (rand(4097)-2048);
vRand = Vector(rRand);
RocketDir = Normal(SeekingDir + vRand);
This is what that code SHOULD do in my mind, which obviously isn't working properly cus that doesn't work.
First I made a random number between 0 and 4096, then subtract 2048 leaving me with a number between -2048 and 2048. I do that for the pitch, yaw, and roll of rRand then make a vector with those rotation properties. I should have a vector that is +-2048 in all axis. Then I take the normal of the SeekingDir (vector to target) and the vRand (the random vector I just made) and add them together. From the tutorials I read I thought that was supposed to add the two vectors together which should basically SeekingDir and make it +-2048 for all axis.
When I load it into the game however it completely ignores the SeekingDir and the rockets only fly due east. They wobble with the +-2048 in all directions but the original vector they are wobbling off is east and not the SeekingDir like it should be.
My other problem is that the rockets are a little too accurate, as in they never miss. I tried finding the difference between the direction I want the rocket to travel in (seek + rand) and the direction the rocket was currently traveling in but I couldn't figure out how to compare them like that. I figure if I can get the difference between them I can make sure it's not too great (rocket is turning too fast) and if it is I can reset it back to the max value.
The regular ut seeking rocket works fine but I don't really understand all that code. For example the line that says Accellerationr = 25 * SeekingDir (I think). Sure that makes sense when you first read it but looking at the code (and the classes above it) I don't find anything that actually USES the accelleration setting so I can't figure out how it effects the flight since there is no code that uses it.
Anyways, if anyone could help me with adjusting/adding/comparing vectors I'd really appreciate it. Nomatter what I try the solution to those problems seems to keep slipping through my fingers.
rRand.Pitch = (rand(4097)-2048);
rRand.Yaw = (rand(4097)-2048);
rRand.Roll = (rand(4097)-2048);
vRand = Vector(rRand);
RocketDir = Normal(SeekingDir + vRand);
This is what that code SHOULD do in my mind, which obviously isn't working properly cus that doesn't work.
First I made a random number between 0 and 4096, then subtract 2048 leaving me with a number between -2048 and 2048. I do that for the pitch, yaw, and roll of rRand then make a vector with those rotation properties. I should have a vector that is +-2048 in all axis. Then I take the normal of the SeekingDir (vector to target) and the vRand (the random vector I just made) and add them together. From the tutorials I read I thought that was supposed to add the two vectors together which should basically SeekingDir and make it +-2048 for all axis.
When I load it into the game however it completely ignores the SeekingDir and the rockets only fly due east. They wobble with the +-2048 in all directions but the original vector they are wobbling off is east and not the SeekingDir like it should be.
My other problem is that the rockets are a little too accurate, as in they never miss. I tried finding the difference between the direction I want the rocket to travel in (seek + rand) and the direction the rocket was currently traveling in but I couldn't figure out how to compare them like that. I figure if I can get the difference between them I can make sure it's not too great (rocket is turning too fast) and if it is I can reset it back to the max value.
The regular ut seeking rocket works fine but I don't really understand all that code. For example the line that says Accellerationr = 25 * SeekingDir (I think). Sure that makes sense when you first read it but looking at the code (and the classes above it) I don't find anything that actually USES the accelleration setting so I can't figure out how it effects the flight since there is no code that uses it.
Anyways, if anyone could help me with adjusting/adding/comparing vectors I'd really appreciate it. Nomatter what I try the solution to those problems seems to keep slipping through my fingers.