Kurt Knispel
New Member
- Joined
- Jul 3, 2014
- Messages
- 19
- Reaction score
- 0
Well, as known, default tank behaviour doesn,t manage turret facing when moving.
WOT turret tanks facing depends on camera facing (if you move mouse, you move camera, and turret moves where camera is facing), so I'm going to use this to make turret face to front as we move vehicle so that it makes a little more difficult for players to detect our bot, report us, and get banned.
Lets start by some basic aspects:
When moving, we must have a Vector3 to move to
When facing camera, we must pass a Vector3 to look at
But, what the hell is Vector3? As it says, it is just a vector, based on 3 positions/coordinates, usually x,y,z corresponding to the 3d axis. To reference them, we can use Vector3 (the whole vector) or one of them (Vector3.x; Vector3.y; or Vector3.z) and there is another way to use it; Vector3.forward; Vector3.Up; Vector3.Right; Vector3.Left;
So, it depends on our interests how we will use it to take profit and achieve our objective.
Now lets try to code something usefull with this.
I will use DefaultBattleRoutine.cs code: we have this function
I have put in bold things that maybe suit what we are looking for, a variable, a vector, a method..... let's try to use it
We can do following; Create a new protected Vector3 in class, to make it accesible but not visible, assing it a value, use it.
Create a new protected Vector3 in class
Go to the top of class and add line as shown here;
Assing it a value
Just under first line in bold in the very first code add;
Use it.
Finally, just before ending CreateRoamBehaviour function add
Ready, I will compile this afternoon and see what happens. I'm afraid it wouldn't work, but its a beggining.....
WOT turret tanks facing depends on camera facing (if you move mouse, you move camera, and turret moves where camera is facing), so I'm going to use this to make turret face to front as we move vehicle so that it makes a little more difficult for players to detect our bot, report us, and get banned.
Lets start by some basic aspects:
When moving, we must have a Vector3 to move to
When facing camera, we must pass a Vector3 to look at
But, what the hell is Vector3? As it says, it is just a vector, based on 3 positions/coordinates, usually x,y,z corresponding to the 3d axis. To reference them, we can use Vector3 (the whole vector) or one of them (Vector3.x; Vector3.y; or Vector3.z) and there is another way to use it; Vector3.forward; Vector3.Up; Vector3.Right; Vector3.Left;
So, it depends on our interests how we will use it to take profit and achieve our objective.
Now lets try to code something usefull with this.
I will use DefaultBattleRoutine.cs code: we have this function
Code:
public Composite CreateRoamBehaviour()
{
return new PrioritySelector(ctx => ObjectiveManager.FirstObjective, // Objective as context please. Kthx!
CommonBehaviours.CreateWaypointNavigationBehaviour(),
// If we're out of waypoints to navigate, just rush the objective from where we are currently.
new Decorator(ret =>
{
[B]var objective = ret as WotObjective;[/B]
if (objective == null)
Logging.Write("[{0}] Objective is null, something went terribly wrong!", ScyllaWot.Me.Arena.Name);
return objective != null && [B]objective.Location != Vector3.Zero;[/B]
},
new Sequence(
CommonBehaviours[B].MoveToAndStop[/B](ret => (ret as WotObjective).Location.Value, 10f, true),
new Action(ret => { Poi.Current = new Poi(PoiType.Objective, "Moving to complete objective", (ret as WotObjective)); })
)
)
);
}
I have put in bold things that maybe suit what we are looking for, a variable, a vector, a method..... let's try to use it
We can do following; Create a new protected Vector3 in class, to make it accesible but not visible, assing it a value, use it.
Create a new protected Vector3 in class
Go to the top of class and add line as shown here;
Code:
public class DefaultBattleTank : ITankRoutine
{
public Composite RoamBehaviour { get { return CreateRoamBehaviour(); } }
public Composite CombatBehaviour { get { return CreateCombatBehaviour(); } }
[COLOR="#0000CD"]protected Vector3 Direction;[/COLOR]
Assing it a value
Just under first line in bold in the very first code add;
Code:
var objective = ret as WotObjective;
[COLOR="#0000CD"]Direction = objective.Location;[/COLOR]
Use it.
Finally, just before ending CreateRoamBehaviour function add
Code:
);
[COLOR="#0000CD"]Camera.LookAt (Direction);[/COLOR]
}
Ready, I will compile this afternoon and see what happens. I'm afraid it wouldn't work, but its a beggining.....
Last edited: