1 registered members (TipmyPip),
18,388
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
How to find physics object's collision point ?
#56934
10/05/05 02:18
10/05/05 02:18
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Hi all,
I want to make mesh deforming to my car (damage). My car will get damage from other physics objects /cars/, map entities, models. I don't know how to find collision points /nearest vertex numbers from collision point/.
Please help me ?
Olzii
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: How to find physics object's collision point ?
[Re: Marco_Grubert]
#56936
10/14/05 03:10
10/14/05 03:10
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Hi Marco,
Thanks for replying. I have following questions :
1. I am using EVENT_FRICTION to receive contac infos. I have searched nearest vertex number from TARGET.X in object which receives damage. After i have found nearest vertex, did mesh deforming at this vertex. But it is working wrong. I want to damage my model at collision point.
2. EVENT_FRICTION is working OK with physics entity and non-physics entity. But it is not working when two physics entities collide.
Olzii
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: How to find physics object's collision point ?
[Re: Marco_Grubert]
#56938
10/15/05 05:25
10/15/05 05:25
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
It is not working. This means that i am finding nearest vertex from TARGET and damaging it, but it doesnot damage at right position. For example my car has received impact at front and damage is somewhere else /back side, left or right side/.
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: How to find physics object's collision point ?
[Re: Olzii]
#56939
10/15/05 05:28
10/15/05 05:28
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Here is my code :
function car_event { var i=0; var k=0; var tttt[3]; var min_val=500; var min_i; if(event_type == event_friction) { while (i < ent_vertices (my)) { vec_for_vertex(tttt,my,i); k=vec_dist(tttt,you.x); //k=vec_dist(tttt,target.x); if(k<min_val) {min_val=k; min_i=i;} i+=1; } vec_for_mesh(temp,my,min_i); vec_scale(temp,0.9); vec_to_mesh(temp,my,min_i); ent_fixnormals(my,0); } }
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: How to find physics object's collision point ?
[Re: Olzii]
#56940
10/24/05 22:15
10/24/05 22:15
|
Joined: Sep 2003
Posts: 3,236 San Diego, CA
Marco_Grubert
Expert
|
Expert
Joined: Sep 2003
Posts: 3,236
San Diego, CA
|
The you.x part does not make sense, but I've got the code working like this: Code:
var i=0; var k=0; var tttt[3];
var min_val=500; var min_i;
while (i < ent_vertices (my)) { vec_for_vertex(tttt,my,i); //k=vec_dist(tttt,you.x); k=vec_dist(tttt,target.x); if(k<min_val) {min_val=k; min_i=i;} i+=1; }
vec_for_mesh(temp,my,min_i); vec_scale(temp,0.2); vec_to_mesh(temp,my,min_i); ent_fixnormals(my,0);
|
|
|
Re: How to find physics object's collision point ?
[Re: Marco_Grubert]
#56941
10/25/05 07:11
10/25/05 07:11
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
@Marco
I have already tested this line k=vec_dist(tttt,target.x); and it has bad effect, that is why i changed it to k=vec_dist(tttt,you.x);
Because of target.x not working correct, i am asking it from you.
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
Re: How to find physics object's collision point ?
[Re: Marco_Grubert]
#56943
10/26/05 05:56
10/26/05 05:56
|
Joined: Sep 2004
Posts: 260 UB,Mongolia
Olzii
OP
Member
|
OP
Member
Joined: Sep 2004
Posts: 260
UB,Mongolia
|
Thanks Marco,
Now it is working. But this version affects my sky. I have used day night transition script with beautiful sky. After i have updated my version, this script doesnot work.
Please tell me, why it does not work ? New version have changes in sky entity ?
The Empire of the Mongols comprised the largest continuous land empire ever, reaching from Korea to Poland
|
|
|
|