Hi!
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?Code:function EndGame() { `log(MyPos); MyPos = self.Location; MaxZHeight = 2500.0; if (MyPos.Z > 2500.0) { //hopp = vect(MyPos.X,MyPos.Y,MaxZHeight); MyPos.Z = MaxZHeight; self.SetLocation(MyPos); } }
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 =)



Reply With Quote
![Send a message via ICQ to Blade[UG]](images/styles/TwistedDark/misc/im_icq.gif)
![Send a message via AIM to Blade[UG]](images/styles/TwistedDark/misc/im_aim.gif)
![Send a message via MSN to Blade[UG]](images/styles/TwistedDark/misc/im_msn.gif)
![Send a message via Yahoo to Blade[UG]](images/styles/TwistedDark/misc/im_yahoo.gif)



Bookmarks