Re: Vector/single rotation comparison math
Posted: Sun Oct 09, 2016 8:33 pm
I'm following this thread with interest because - in own more remedial way - I'm struggling with some of the same problems at the moment. But just now I'm stuck on one thing in particular. I'm trying to modify bot behaviour, and I've been doing some testing to see what's achievable. At the moment I just want a bot to rotate by an angle that I specify. This happens... but then the bot immediately re-adjusts to its previous vector, and I've no idea why.
I'm inheriting from HumanBotPlus.uc, and messing about with the PlayRunning function. Here (at the start of the function) I've inserted a "GotoState", and then I have something like:
*page with useful constants http://romerounrealscript.blogspot.co.u ... cript.html
I've also tried:
I run the game with a 'slomo' setting that allows me to study what's happening more easily, and in each case the bot momentarily spins around by 90 degrees, but then instantly returns to its previous orientation. Any idea why this might be?
I'm inheriting from HumanBotPlus.uc, and messing about with the PlayRunning function. Here (at the start of the function) I've inserted a "GotoState", and then I have something like:
Code: Select all
....
Begin:
Acceleration = vect(0, 0, 0); // Halt current movement
TurnTo(Destination);
myRot = Rotation; // 'myRot' is a global rotator
myRot.Yaw += (90 * 182.0444); // Turn clockwise 90 degrees: apparently the UDK defines some useful constants for calculations like this*
SetRotation(myRot);
Sleep(5); // Sleep 5 seconds so that I can observe the change
I've also tried:
Code: Select all
....
Begin:
Acceleration = vect(0, 0, 0);
myVec = Destination - Location; // myVec is a global vector
myRot = rotator(myVec);
myRot.Yaw += (90 * 182.0444);
SetRotation(myRot);
Sleep(5);