Data Realms Fan Forums
http://45.55.195.193/

Script: Force actor to never spin around [Probably solved]
http://45.55.195.193/viewtopic.php?f=75&t=25568
Page 1 of 1

Author:  Gotcha! [ Sun Sep 18, 2011 9:28 pm ]
Post subject:  Script: Force actor to never spin around [Probably solved]

Hello peoplepersons,

Is it possible to script having an actor not spin around when hit by something heavy?
I'd like to see my mechs take on missiles and the like and just stand there soaking it up instead of turning into a wheel and spin out of the screen. :)

I could increase the mass to insane levels, but I think everyone would have an idea what that does.

Author:  Roast Veg [ Sun Sep 18, 2011 11:43 pm ]
Post subject:  Re: Script: Force actor to never spin around

Code:
function Update(self)
    self.RotAngle = 0;
end

Crude and ugly, and quite likely to produce some weird results.

Author:  CaveCricket48 [ Mon Sep 19, 2011 12:00 am ]
Post subject:  Re: Script: Force actor to never spin around

Let me make that a bit nicer.
Code:
function Create(self)

   self.maxSpin = 3;

end

function Update(self)

   if math.abs(self.AngularVel) > self.maxSpin then
      if self.AngularVel < 0 then
         self.negativeNum = -1;
      else
         self.negativeNum = 1;
      end
      self.AngularVel = self.maxSpin * self.negativeNum;
   end

end

Untested BTW.

Author:  Gotcha! [ Mon Sep 19, 2011 12:49 am ]
Post subject:  Re: Script: Force actor to never spin around

Thanks, both. I'll test this out. :)

Author:  carriontrooper [ Mon Sep 19, 2011 1:25 pm ]
Post subject:  Re: Script: Force actor to never spin around [Probably solved]

Here's another solution.

Code:
function Update(self)
    self.AngularVel = self.AngularVel * 0.75;
end


75% of your angularvel every script update. Which looks sturdy enough to get hit by an RPG and didn't budge.

Author:  Gotcha! [ Mon Sep 19, 2011 1:57 pm ]
Post subject:  Re: Script: Force actor to never spin around [Probably solved]

Thanks. :)

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/