View unanswered posts | View active topics It is currently Mon Dec 17, 2018 1:45 am



Reply to topic  [ 3 posts ] 
 Retaining physics when changing object type 
Author Message

Joined: Wed Feb 11, 2009 11:01 pm
Posts: 28
Reply with quote
Post 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)?


Fri Jul 06, 2012 5:34 am
Profile
User avatar

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


Fri Jul 06, 2012 7:22 am
Profile

Joined: Wed Feb 11, 2009 11:01 pm
Posts: 28
Reply with quote
Post Re: Retaining physics when changing object type
Thanks. I only asked because Actor is not explicitly shown to be an MO.


Fri Jul 06, 2012 8:23 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.015s | 13 Queries | GZIP : Off ]