I'm trying to do a simple function that will cap my vehicle's Z value (both Max and Min). My plan is simply to check if my vehicle is above a Z-value (2500.0 at the moment) and then either set it back to 2500.0 or set the velocity to 0.
Currently this is my very unfunctional code:
Could it have to do with the fact that I first declare that MyPos = self.Location and I after that change MyPos.Z?
MyPos = self.Location;
MaxZHeight = 2500.0;
if (MyPos.Z > 2500.0)
//hopp = vect(MyPos.X,MyPos.Y,MaxZHeight);
MyPos.Z = MaxZHeight;
My other plan was to create a new vector (hopp), however the compiler complains that it is lacking a X, Y or Z-value (float MaxZHeight).
I can't even write: hopp = vect(MyPos.X,MyPos.Y,MyPos.Z) something that confuses me.
Thanks in advance =)