Data Realms Fan Forums http://45.55.195.193/ |
|
Retaining physics when changing object type http://45.55.195.193/viewtopic.php?f=73&t=31408 |
Page 1 of 1 |
Author: | Zuriki [ Fri Jul 06, 2012 5:34 am ] |
Post subject: | Retaining physics when changing object type |
I'm trying my hand at a relatively simple mod as my first foray in CC modding. I was wondering if it's possible to retain the physics of an object if I covert it to another object (or rather, replace it with another object). Specifically, I have a TDExplosive that upon being thrown instantly is deleted and replaced with an Actor (Maybe AHuman depending on whether Actors function the way I require), however I would like the Actor to retain the momentum of the TDExplosive. If it's not possible it doesn't matter, it's not critical to my mod, just a bit of polish. --- On the subject, do Actors have physics (I ask because the examples given in the Wiki -- brain cases -- don't)? |
Author: | CaveCricket48 [ Fri Jul 06, 2012 7:22 am ] |
Post subject: | Re: Retaining physics when changing object type |
Everything that's a Movable Object has physics. To retain (though, transfer would be the more accurate term in this case) physics from the TDExplosive to the AHuman (or any other MO), you have the properties: Code: myObject.Pos myObject.Vel myObject.RotAngle myObject.AngularVel Pos is the position of the object as a Vector(), Vel is Velocity of the object as a Vector(), RotAngle is the rotation in radians, and AngularVel is the rotational speed in radians per second if I recall correctly. So you'd have something in your script like Code: if blah blah then local actor = CreateAHuman("Dummy, or something"); actor.Pos = self.Pos; actor.Vel = self.Vel; actor.RotAngle = self.RotAngle; actor.AngularVel = self.AngularVel; ...Team/AI definition maybe too?... MovableMan:AddActor(actor); end |
Author: | Zuriki [ Fri Jul 06, 2012 8:23 am ] |
Post subject: | Re: Retaining physics when changing object type |
Thanks. I only asked because Actor is not explicitly shown to be an MO. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |