Inside3D!
     

misc_model
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Scrama



Joined: 28 Aug 2009
Posts: 20
Location: Siberia, Omsk

PostPosted: Thu Mar 11, 2010 3:25 am    Post subject: Reply with quote

Just a part of RTNC code
Code:

/*QUAKED misc_model (0 1 0) (-8 -8 -8) (8 8 8)
Just sprite or model.
*/

void() misc_static_model =
{
   if (!self.model)
   {
      remove (self);
      return;
   }
   precache_model (self.model);
   setmodel (self, self.model);
   makestatic(self);
}

void() model_think =
{
   if (self.frame == self.cnt) self.frame = self.health;
   else self.frame = self.frame + 1;
   self.nextthink = time + 0.1;
};
/*QUAKED misc_animated_model (0 1 0) (-8 -8 -8) (8 8 8)
Animated sprite or model.
*/
void() misc_animated_model =
{
   if (!self.model)
   {
      remove (self);
      return;
   }
      
   precache_model (self.model);
   setmodel (self, self.model);
   
   self.movetype = MOVETYPE_NOCLIP;
   self.solid = SOLID_NOT;
   self.health = self.frame;
   self.think = model_think;
   self.nextthink = time + 0.1;
};

I using clip for collision, it can be better fited to model size/shape
_________________
http://scrama_levelart.livejournal.com
Back to top
View user's profile Send private message
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Mon Mar 15, 2010 12:13 am    Post subject: Reply with quote

I finally did it. I added the SOLID declarations to the touch function. Easy as pie. The md3 model is now rock solid, I can stand on it and it blocks movement. Thanks for your help guys. Here is the function I'm using:

Code:
void() object_touch =
{
   te_ElectricSparks(self.origin); // test
   self.solid = SOLID_BBOX;

   sprint(other, "This should be a model!\n");
};

void() misc_object =
{
   self.touch = object_touch;
   precache_model ("progs/barrel.md3");
   setmodel (self, "progs/barrel.md3");
   setsize (self, self.mins , self.maxs);
   
   setorigin (self, self.origin);

   StartItem ();
};


So far, the mod goes according to plan. This model was a big issue and it got me nailed down for a while. I also managed to implement a particle effect whenever I touch the object. That's why that sparks function is there.

Thus, it can be used to power up an electrical fence, and, upon touching, electrical sparks fly everywhere. Together with a hurt function, I might get something pretty solid.

I was also able to assign an explosion upon touching, and that's my first anti-personnel mine ever created. Razz
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
ceriux



Joined: 06 Sep 2008
Posts: 968
Location: Florida, USA

PostPosted: Mon Mar 15, 2010 1:36 am    Post subject: Reply with quote

i suggest taking a look at the light entities with a model, after that make sure its not static and go from there.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Scrama



Joined: 28 Aug 2009
Posts: 20
Location: Siberia, Omsk

PostPosted: Mon Mar 15, 2010 2:09 am    Post subject: Reply with quote

Its not static coz its animated.
_________________
http://scrama_levelart.livejournal.com
Back to top
View user's profile Send private message
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Mon Mar 15, 2010 8:35 pm    Post subject: Reply with quote

Thanks again, guys. The problem has been solved, and it works just fine. I have a movie for you, it's in production as we speak. And it will have a separate thread. It's something BIG!

EDIT: Until the new project has some "meat" on, I give you my md3 misc_model stuff. Working as planned.

http://vimeo.com/10201965
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
Swift



Joined: 26 Jan 2010
Posts: 44

PostPosted: Sat Apr 17, 2010 8:42 am    Post subject: Reply with quote

Why is
self.solid = SOLID_BBOX;
in the touch function and not in the spawn function?
Back to top
View user's profile Send private message
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Sat Apr 17, 2010 9:28 am    Post subject: Reply with quote

Swift wrote:
Why is
self.solid = SOLID_BBOX;
in the touch function and not in the spawn function?


Because it works in the touch function, and not in the spawn function. Don't know why. Could by DarkPlaces. Could be the version of Kleshik I'm using.
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Sat Apr 17, 2010 10:25 am    Post subject: Reply with quote

self.solid = FOO; should be followed by a setorigin or setmodel, otherwise your entity may still be non-solid as it'll not be in the clipping list.
But don't do setsorigin or setmodel inside a touch function! (unless you know they're using DP or FTE or sommit that has the crash bug fixed).
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Mon Apr 19, 2010 7:47 pm    Post subject: Reply with quote

Spike wrote:
self.solid = FOO; should be followed by a setorigin or setmodel, otherwise your entity may still be non-solid as it'll not be in the clipping list.
But don't do setsorigin or setmodel inside a touch function! (unless you know they're using DP or FTE or sommit that has the crash bug fixed).


Thanks Spike! It's on my TODO list now!
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2004 phpBB Group