|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5319
07/07/01 10:17
07/07/01 10:17
|
Joined: Oct 2000
Posts: 1,543 Germany
Alexander Esslinger
Senior Developer
|
Senior Developer
Joined: Oct 2000
Posts: 1,543
Germany
|
Theoretically, PSCJ's code should work - just replace vec_for_mesh by vec_for_vertex and change my.pos to my.x. Vec_for_mesh and vec_to_mesh are still beta-features, they will be available in the next official A5-version.
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5320
07/07/01 17:23
07/07/01 17:23
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Damnit! My code works this way, MY.POS is the same as MY.X it makes no difference which one you use, and VEC_FOR_VERTEX is wrong it should be (and it is) VEC_FOR_MESH. Here from the Beta readme: code:
vec_for_mesh(vector,entity,number); vec_to_mesh(vector,entity,number); Performs realtime mesh deformation of a model or terrain entity. vec_for_mesh() sets the given vector to the mesh coordinates of the given vertex number. Vec_to_mesh() sets the mesh coordinates of the given vertex number to the given vector. The mesh is deformed not only on this entity, but on all models or terrains of the same type. Mesh deformations are lost on exiting the game. They can not increase the model size: mesh vertices deformed 'outwards' stop when reaching the model boundaries. For smooth mesh deformation the model should have the high prec flag set.
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5322
07/08/01 07:47
07/08/01 07:47
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
I haven't test it but Master's Code should work! vec_for_vertex replaces ent_vertex, but this function gives you the real world coordinates of the Vertex. vec_for_mesh gives you the Mesh-Coordinate of the Modell/Terain and have to be used for a deformation! I think the only differences between the code of Master an me is, that his code is easier to set up but for that the engine have a bit more to work. But I think this "more to work" is really not much, I should test it. P.S.: Again: vec_for_vertex, vec_for_mesh, vec_to_mesh are only Beta-Features at the moment. But the mesh-functions doesn't work correctly (BUT THEY WORK!).
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5323
07/08/01 00:14
07/08/01 00:14
|
Joined: Oct 2000
Posts: 1,543 Germany
Alexander Esslinger
Senior Developer
|
Senior Developer
Joined: Oct 2000
Posts: 1,543
Germany
|
Okay, I haven't used both functions yet. But, you cannot compare a relative-entity coordinate with a world-coordinate, this gives no sense to me. I keep by my opinion - it's wrong.
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5324
07/08/01 11:23
07/08/01 11:23
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Ahhh! Now I know what you are meaning! Sorry, I understood you thought that vec_for_vertex is the function for deformation, my fault. Of course, if you have a wold coordinate and want to compare it with an Terrain/Model-Vertex you need the World-Coordinate of the Vertex (vec_for_vertex), after that you can search the Mesh-Coordinate (vec_for_mesh). I made it this way in my code but haven't look exactly for that in Masters Code. So keep your opinion you are right ;-)!
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5325
07/08/01 20:33
07/08/01 20:33
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
My code is right it is basically the same as in readbeta.txt: code:
function dent(ent,num) // make a "dent" into a mesh { vec_for_mesh(temp,ent,num); vec_scale(temp,0.9); // move the vertex inwards by 10% vec_to_mesh(temp,ent,num); }
Here read it: http://www.conitec.org/readbeta.txt I made my code from this so if JCLs code is not working it's not my fault. JCLs Code workin' = my Code workin', understood?
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5326
07/08/01 21:01
07/08/01 21:01
|
Joined: Oct 2000
Posts: 1,543 Germany
Alexander Esslinger
Senior Developer
|
Senior Developer
Joined: Oct 2000
Posts: 1,543
Germany
|
Sorry PSCJ, but your code should look like this: code:
SKILL EXPLOSION_RANGE {VAL 100;} SKILL CURRENT_VERTEX {VAL 0;} SKILL VERTEX_POS {}// In das event des Flugzeugs einfügen ... WHILE (CURRENT_VERTEX < ENT_VERTICES(YOU)) { CURRENT_VERTEX += 1; VEC_FOR_VERTEX(VERTEX_POS,YOU,CURRENT_VERTEX); IF(VEC_DIST(MY.POS,VERTEX_POS) < EXPLOSION_RANGE) { VEC_FOR_MESH(VERTEX_POS,YOU,CURRENT_VERTEX); VERTEX_POS.Z -= EXPLOSION_RANGE - VEC_DIST(MY.POS,VERTEX_POS); VEC_TO_MESH(VERTEX_POS,YOU,CURRENT_VERTEX); } }
|
|
|
Re: vec_for_mesh() - How to find a Vertex?
#5327
07/08/01 22:21
07/08/01 22:21
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
JCL's Code geht davon aus dass per num-Parameter schon ein Vertex bekannt ist. Dein Code soll aber erstmal nach einem Vertex suchen der in der Nähe der Entity liegt. Wie Raul schon sagte muss man aber um die Distanz zwischen den Objekten zu messen ihre echten Welt-Koordinaten benutzen, die von vec_for_vertex geliefert werden. Sobald du dann den gewünschten Vertex hast kannst du vec_for_mesh einsetzen. Aber du siehst es ja in Rauls code, er hat ihn korrigiert. Müsste funktionieren, diesmal teste ichs aber wirklich mal ;-)! Edit: Was mir an Rauls Code auffällt: Für vec_for_mesh benutzt du ja auch die Variable vertex_pos, das ist nicht zu empfehlen da im Code ja nach dem "meshen" nochmal die Distanz der Welt-Koordinaten im Code benötigt wird VEC_FOR_MESH(VERTEX_POS,YOU,CURRENT_VERTEX); VERTEX_POS.Z -= EXPLOSION_RANGE - VEC_DIST(MY.POS,VERTEX_POS); Entweder man speichert die Distanz vorher in einer anderen Variable oder benutzt beim meshen einen anderen Vektor.
|
|
|
|