View unanswered posts | View active topics It is currently Mon Jul 08, 2024 4:19 pm



Reply to topic  [ 6 posts ] 
 Script: Force actor to never spin around [Probably solved] 
Author Message
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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.


Last edited by Gotcha! on Mon Sep 19, 2011 12:50 am, edited 1 time in total.



Sun Sep 18, 2011 9:28 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Sun Sep 18, 2011 11:43 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post 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.


Mon Sep 19, 2011 12:00 am
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post Re: Script: Force actor to never spin around
Thanks, both. I'll test this out. :)


Mon Sep 19, 2011 12:49 am
Profile
User avatar

Joined: Mon Apr 13, 2009 12:27 pm
Posts: 813
Location: Yogyakarta, Indonesia. A slice o' paradise.
Reply with quote
Post 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.


Mon Sep 19, 2011 1:25 pm
Profile YIM WWW
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post Re: Script: Force actor to never spin around [Probably solved]
Thanks. :)


Mon Sep 19, 2011 1:57 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.033s | 13 Queries | GZIP : Off ]