0 registered members (),
1,295
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Customize collision shape
[Re: peteredlin]
#351755
12/28/10 13:20
12/28/10 13:20
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
May be you can combine some models (or just use one model with the shape that you need) and then set POLYGON flag on it? You can customize BBOX by setting both FAT and NARROW flags on it, and then playing with it's MAX_X and MIN_X parameters:
my.eflags |= FAT | NARROW;
vec_set(my.min_x,vector(-50,-50,-50)); // play with -50 (X,Y,Z)
vec_set(my.max_x,vector(50,50,50)); // play with 50 (X,Y,Z)
|
|
|
Re: Customize collision shape
[Re: peteredlin]
#351771
12/28/10 14:07
12/28/10 14:07
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
Then right before setting POLYGON flag, use: c_setminmax(my); This will give right BBOX depending on all animation frames, but if it's static model without any animations, the BBOX will just fit right ![laugh laugh](/ubb7/images/graemlins/default_dark/laugh.gif) Or set randomly BBOX (example is in my previous posts). Then set POLYGON flag again, should work ![laugh laugh](/ubb7/images/graemlins/default_dark/laugh.gif)
Last edited by 3run; 12/28/10 14:09.
|
|
|
Re: Customize collision shape
[Re: 3run]
#351774
12/28/10 14:19
12/28/10 14:19
|
Joined: Sep 2010
Posts: 82
peteredlin
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 82
|
Now the shape looks litle better but it still lools like one box, not the shape of the trailer...
Maby its better to make a few simple boxe's and combine them together. But what is the right way to do this?
How to connect a collision shape to the model?
Last edited by peteredlin; 12/28/10 14:20.
|
|
|
Re: Customize collision shape
[Re: peteredlin]
#351777
12/28/10 14:27
12/28/10 14:27
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
No dude, no. BBOX will looks like BOX any way (that's why it called Bounding Box ![grin grin](/ubb7/images/graemlins/default_dark/grin.gif) I guess) But collusion will be made depending on the trailers mesh (POLYGONS). Make a little test, make a player, put him above the track and simply walk ![laugh laugh](/ubb7/images/graemlins/default_dark/laugh.gif) You'll notice that player collides with trailer depending on it's surfaces.
|
|
|
Re: Customize collision shape
[Re: 3run]
#351780
12/28/10 14:46
12/28/10 14:46
|
Joined: Sep 2010
Posts: 82
peteredlin
OP
Junior Member
|
OP
Junior Member
Joined: Sep 2010
Posts: 82
|
Ok i understand, but i think i don't use BBox in the right way, cause it collides still as a box.(i tryed) I am new to this is used yhe following code:
trailer = ent_create("trailer\\trailer.mdl",spawnp,NULL);
phent_settype (trailer, PH_RIGID, PH_BOX); // set the physics entity type
phent_setmass (trailer, 15000, PH_BOX); // and its mass
phent_setgroup(trailer,4);
phent_setfriction (trailer, 80); // set the friction
phent_setdamping (trailer, 40, 40); // set the damping
phent_setelasticity (trailer, 0, 20); // set the elasticity
trailer.eflags |= FAT | NARROW;
c_setminmax(trailer);
set(trailer,POLYGON);
Last edited by peteredlin; 12/28/10 15:00.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|